Forums

WOWonder and Sngine discussion forums

MY WOWONDER PROFILE WIDGET
MY WOWONDER PRODUCTS WIDGET
MY WOWONDER PAGES WIDGET
LATEST FORUMS THREADS

Read the Community Guidelines

Community Guidelines

Help keep our community respectful and collaborative by following these rules:

  • No Unsolicited Payment Requests: Do not ask for money or paid services unless the person seeking help requests it.
  • Keep Discussions Public: Questions and answers should stay in the forum unless the original poster requests a private conversation.
  • Post in Correct Categories: Place each post in its specific category to help keep the forum organized and accessible.
  • No Spam or Self-Promotion: Advertising unrelated products, services, or self-promotion without consent is not allowed.
  • Respectful Communication: Engage with others respectfully and avoid offensive or disruptive behavior.
  • Ask Questions in the Forum: All questions must be asked in the forum, not in chat.

Violating these rules may result in warnings or bans.

External Link warning when leaving site

Edy Lee
Admin
Joined: 2024-11-24 00:57:42
2025-01-07 22:14:37

Javascript code


    function warnExternalLink(event) {
        event.preventDefault(); // Prevent the default link behavior
        var externalLink = event.target.href;
        if (confirm("You are about to leave our site. Continue?")) {
            window.location.href = externalLink;
        }
    }

    // Attach the event listener to all external links
    document.addEventListener("DOMContentLoaded", function() {
        var externalLinks = document.querySelectorAll('a.external');
        externalLinks.forEach(function(link) {
            link.addEventListener('click', warnExternalLink);
        });
    });

template code

{foreach from=$links item=link}
    {if $link.external}
        <a href="{$link.url}" class="external">{$link.text}</a>
    {else}
        <a href="{$link.url}">{$link.text}</a>
    {/if}
{/foreach}

 
Jane Marcia
Admin
Joined: 2024-11-24 00:49:31
2025-01-08 22:30:09

Can you please put that code inside <pre>? It's not easy to copy from a mobile. Thanks