This portion was added because when you click the link in the window, the popup window stayed open even when use use the browser back button. Adding the below code prevents this.
You can’t make something use JavaScript if JS is disabled. So how can the users get to this link if JS is what makes the link appear? What exactly are you trying to do?? Can we have a link to your example??
tells the browser NOT to perform the default action of opening the url you have listed (so that only the Javascript part works).
Your example shows the SitePoint URL. Do you have a real URL? Because if the link did not work without Javascript then I’m wondering what the return false was doing in there in the first place.
In other words, the return false suggests to me that the link should have been working when Javascript is disabled. What is happening when you click it?
I am using Colobox which is based on JavaScript (JQuery).
When you click a link, a window popup like a Modal Dialog box containing inline contents.
The problem is when the box pop up, there is a link in the box, which the user is suppose to click. However, when the user click the link the colorbox is still open or active on the screen and does not close or go away.
So adding the above code to the link closes the box when the link is clicked.
Otherwise the box remain open, even when clicking the link takes you to another page or tab, or when you hit the back button on the browser, the box is still open.
I can whip up an example but I was hoping this would be a simple fix.
I would understand it better if you made a small example, but…
The problem is when the box pop up, there is a link in the box,
As I understand it, Javascript written on one window generally doesn’t affect another window… that other window could have it’s own JS which closes itself after the link is clicked.
So, I had been under the impression that the link on the original window was who’s not working.
So yeah, I’d like to see a small demo so I can see what its doing. While I do little with jQuery, I could still probably see how this could work with and without JS.
Also, maybe this thread should go over to Javascript, where the JS gurus will see this.