You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Online

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

#116707 automatically opening link after predefined time

Posted in ‘Mediabox’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Mika on Friday, 14 June 2024 14:05 BST

Mika

Is it possible to use the jce image editor to insert a link so that the linked page opens automatically after a predefined time (e.g. 6 seconds)? I'm working with Joomla 4.4. and JCE Pro

Ryan

Please try JCE MediaBox 2.1.10 Beta - https://www.joomlacontenteditor.net/downloads/mediabox/development

This will allow you to create a popup link that will open a Mediabox popup automatically when the page loads after a delay of x seconds.

For example:

<a href="https://en.wikipedia.org/wiki/Cassiopeia" type="iframe" class="jcepopup" data-mediabox="1" data-mediabox-width="800" data-mediabox-height="600" data-mediabox-title="Cassiopeia" data-mediabox-caption="Mother of Andromeda" data-mediabox-autopopup="multiple" data-mediabox-delay="10">Cassiopeia</a>

using the data-mediabox-autopopup="multiple" and data-mediabox-delay="10" attributes will open a popup each time the page loads after a delay of 10 seconds.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Mika

thanks for answering! I tried it, but: it's not what I want. I don't want to open the page in a mediabox popup but the  image / link in the image should lead to the page /site itself. It's easy, I know, but I don't know the trick to open the link automatically after a predefined time instead or on click.

Ryan

You would need to use some javascript on the page to do this. Here is some example code (thanks to ChatGPT):

// Wait for the page to fully load
window.addEventListener('load', function() {
    // Find the link with the desired href
    var targetHref = 'http://example.com'; // Replace with the actual href you're looking for
    var links = document.getElementsByTagName('a');

    for (var i = 0; i < links.length; i++) {
        if (links[i].href === targetHref) {
            // Open the link in a new tab after a 10-second delay
            setTimeout(function(link) {
                window.open(link, '_blank');
            }, 10000, links[i].href);

            break;
        }
    }
});

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Mika

I tried it in different places, but seems to not working in Cassiopeia, Joomla .  I#m just working to upgrade from Joomla 3, where it worked (see page https://www.gisela-waeschle.de), to Joomla 4.    I'm looking now for another solution for the entrance-page ... thank you!