Hey, I want to inform my users via a popup notice that they’ll be forwarded to an external site when they click on an external link:
-
User clicks on external link
-
Popup (e.g. lightbox) opens
-
redirect to external website (address of external link)
I have found the following code, but its not working:
import wixLocation from 'wix-location';
export function hoverBox2_click(event, $w) {
$w('#hoverBox1').hide("fade",500);
setTimeout(function () {wixLocation.to("/test"),500});
}
instead of “/test” there must be automatically the address of the external link.
Would appreciate any help.
Thanks in advance!
Hi @alexander.lehmann1991
-
Pop-up Opened But Link user not redirecting to new Page ?
-
Pop-up Only Not Working.
-
What code you have written to Open Pop-up
-
and Where you written code for Pop-up OnClick [Button] ?
-
Or, It redirects without show pop-up ?
Can you please give more clarity on the issue you are facing ?
The Pop-Up doesn’t open and the user redirects directly to the external page.
The code is written in my first post. So, there is no code for opening the popup I guess?
So,When Clicking On Button User Redirects to that Page Without Open Popup;
- Unlink that Button.

2. Then Write Below code On Click of that Button
export function button1_click_1(event) {
// Add your code for this event here:
import wixWindow from ‘wix-window’ ;
wixWindow . openLightbox ( “LightboxName” );
setTimeout ( function () {
wixLocation.to(“/test”)
}, 5000 );
}
You can adjust the Delay time once you see the Full result
Thanks for your help so far. I have a list of links in a textbox. The following code opens the particular link in a new tab and the lightbox appears.
So far, I added the following code:
import wixLocation from ‘wix-location’ ;
import wixWindow from ‘wix-window’ ;
export function text12_click(event) {
// Add your code for this event here:
wixWindow.openLightbox( "#welcomebox" );
setTimeout( **function** () {
}, 5000 );
}
What I want is the active confirmation of a user via a submit button in the lightbox (“Do you want to get redirected to a external page - YES”) and then get the redirect in a new tab. Do you have an idea how this works?
@ajithkrr I don’t think “target” helps since the link already opens in a new tab. Or am I missing something?