We are trying to ensure that information is seen even if javascript is disabled.

So we would like to create something that opens a popup as normal however if javascript is disabled it opens a new tab or window with the information. But if javascript is enabled it just opens the popup not the new window.

Is something like this possible and if so how would we do it?

Thank you.

Recommended Answers

All 4 Replies

You could have the click be on an <a> tag with a target="_blank" which will open a new window. But if they have javascript enabled you can bind events to it with onlclick to open a popup and return false (to prevent the other window from opening;

Oh that sounds great could you please provide an example or the code I would use so I can see how it is done?

Im really trying to learn all of this.

Thank you.

Oh that sounds great could you please provide an example or the code I would use so I can see how it is done?

Im really trying to learn all of this.

Thank you.

This isn't exactly what has to be done but it's a start. Take a look at w3schools.com for more javascript tutorials on opening windows

<script type="text/javascript">
var popupSomeWindow = function ()
{
  window.open('someurltopopup', 'someparams=hello');
  return false;
};
<a href="someurltopopup?someparams=hello" target="_blank" onclick="return popupSomeWindow();">Popup or new window</a>

Ok I put this together and seems to work beautiful, thanks for the referral.

<a href="http://mywebsite.com" target="_blank" onclick="window.open('http://mywebsite.com','popup','width=507,height=600,scrollbars=yes,toolbar=no,menubar=no,'); return false"><MY LINK" /></a>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.