Making a link work when JavaScript is Disabled or not available

Hello everyone,

I am using ColorBox to display inline content.
When the user click a link, a box popup on the screen.

Here’s the problem, when I disable JavaScript, the link does not work.

Is there anyway to make this work, even when JavaScript is not available?

The window does not work when JavaScript is not enabled and it shouldn’t, but I would still like the link to work.

Here is the link code:

<a href="https://www.sitepoint.com" onclick="javascript: parent.
$.fn.colorbox.close(); window.open(this.href); return false;" target="_blank">Continue to Application</a>

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.

onclick="javascript: parent.
$.fn.colorbox.close(); window.open(this.href); return false;" 

Any general ideas?

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??

this


onclick="javascript: parent.
$.fn.colorbox.close(); window.open(this.href); [b]return false[/b];"

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?

Hello Stomme,

The use of the sitepoint URL is simply for example.

Here is why this portion -


onclick="javascript: parent.
$.fn.colorbox.close(); window.open(this.href); [b]return false[/b];"

was added.

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.

My apologies!

IC

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.