PDA

View Full Version : Disabling pop-ups


snapper
09-27-2005, 04:21 PM
Can anyone point me in the right direction? I would like to be able to detect if a client browser has popups (active content) enabled, as it affects what can be viewed (especially as I have quite a bit of java). Have seen a number of websites which automatically navigate to the site if active content is enabled, but which also have an alternative route which requires client side selection before firing. Or am I just overcomplicating things - should I just leave to to viewer?

konithomimo
09-30-2005, 07:54 AM
what you are trying to do is just a javascript redirect after checking for javascript enabling. Here are a few ways to do it:



<!-- Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
if (navigator.javaEnabled())
window.location = "java-page.html";
else
window.location = "non-java-page.html";
// End -->
</script>


or



<!-- Paste this code into the BODY of your HTML document -->

<BODY>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
window.location="http://www.your-web-site-address-here.com/javascript-page.html";
// End -->
</script>

<noscript>
It appears that your browser does not support JavaScript, or you have it disabled. This site is best viewed with JavaScript enabled.<p>If JavaScript is disabled in your browser, please turn it back on then reload this page.<p>Or, if your browser does not support JavaScript,
click <a href="http://www.your-web-site-address-here.com/no-javascript-page.html">here</a>.
</noscript>



That should help! I suggest the first one.

snapper
10-04-2005, 07:45 AM
Thanks. Haven't quite got to creating the alternative site, but I will try it out.