PDA

View Full Version : java script needed


rebelo
03-07-2002, 04:59 PM
Hi. Looking for a java script that would make a pop up window or even an explorer window allerting the visitor when entering a page with the java script and/ or cookies disabled.
Any help ?

rgds

spaz109ca
03-07-2002, 06:55 PM
I'm not sure what you mean but here is a site that will generate a popup window for you free! You fill in all the information, and it generates the code:

javascript.internet.com/generators/popup-window.html

Jon Hanlon
03-07-2002, 07:59 PM
It's rather difficult creating a script that fires if scripting is disabled!

To check if scripting is disabled, use the <meta> tag, and/or the <noscript> tag.


<html>
<head>
<meta http-equiv="Refresh" content="30 ; url=too_bad_sorry.html">

<script>
function cookiesAreGo() {
document.cookie = "cookieMonster=cookieMonster"; // try to set a cookie
if (document.cookie.indexOf("cookieMonster") == -1) { // it failed
return false;
} else { // it worked! Kill it.
var now = new Date();
now.setTime(now.getTime() - 1000); // one second ago
document.cookie = "cookieMonster=cookieMonster; expires=" + now.toGMTString();
return true;
}
}


function checkUA() {
if (!cookiesAreGo()) {
var aStr = "ALERT \n"
+ "Your browser is NOT set to accept Cookies. \n"
+ "This will prevent our site from functioning properly. \n\n"
+ "To learn more about Cookies, click the OK Button. \n"
if (confirm(aStr)) window.location.replace("faq_cookies.html");
}
window.location.replace("OK_Page.html") // The gateway to the Site

</script>
</head>

<body onload="checkUA()">
<noscript>
To see our site properly you need scripting turned on
<a href="too_bad_sorry.html">Click here</a>
</noscript>
</body>
</html>