PDA

View Full Version : Pop ups


ZiBoom
06-08-2016, 10:11 PM
Whenever we link to a pop up page (say, youtube video), the thread jumps from the topic area where the pop up link resides to the main page. Is there any way to stop that? I apologize as I am a bit of a coding newbie.:confused:

I am using the latest version of VBB 5.

noypiscripter
06-09-2016, 07:09 PM
How do you link to a popup page?

ZiBoom
06-10-2016, 04:56 AM
Sorry...I should have written this better.

I want a link to pop up in a separate window.

Thanks

cellarius
06-10-2016, 09:42 AM
Since you're not giving any detail - for example: how exactly are you triggering the popup? Code! - its hard to help.

Anyway - this is probably a javascript issue. You probably need to add "return false" to the code somewhere. There's plenty of examples around the net.

ZiBoom
06-10-2016, 03:05 PM
I will give that a try. Thank you :D

Also, whilst I understand there are different examples, my problem was a bit more complicated. I am able to get the link to open up in another pop up window. However, the page where the link exists always bounces back to the main page.

Thanks

noypiscripter
06-10-2016, 04:08 PM
You must be using something like this. You have to add return false to the onclick handler.

<a href="#" onclick="window.open('https://www.youtube.com/watch?v=NZYXNofi6zI', '_blank', 'width=400,height=300'); return false;">Watch</a>

But the better code is:

<a href="https://www.youtube.com/watch?v=NZYXNofi6zI" onclick="window.open(this.href, this.target, 'width=400,height=300'); return false;" target="_blank">Watch</a>

cellarius
06-10-2016, 06:20 PM
I will give that a try. Thank you :D

Also, whilst I understand there are different examples, my problem was a bit more complicated. I am able to get the link to open up in another pop up window. However, the page where the link exists always bounces back to the main page.

Thanks
Yes. That's clear. But why do you keep that tiny bit of code from us that actually opens the popup? That's what's causing the error. Why should we guess if you could simply give us something to look at?

ZiBoom
06-11-2016, 03:54 AM
My apologies, but many thanks for your help as that was the trick.

I did not paste the entire code thread here because this is a separate computer from the one I use for coding. But here is the final solution. If I typo, forgive me...but this works on VBB 5

a href="" onclick="window.open('URL', 'TITLE, width=XXX,height=XXX'); return false;">

noypiscripter
06-13-2016, 11:41 PM
That works. But as I mentioned in post #6, the better solution is to put the url in href. The reason is this still give users a choice to open the link in a new tab instead of the popup window by right-clicking the link and choosing 'Open link in new tab' option.