Click to See Complete Forum and Search --> : pop-blocker detection w/ cookie detection


catchup
03-28-2003, 12:29 PM
hello :)

i'm trying to determine whether a user has a pop-up blocker enablem and whether cookie are disabled all in teh same script. I use ASP to only set the cookie. i'm all confused. i would like to say:

if blocker enabled and cookie disabled then
alert = "disable pop-blocker and enable cookies"
else
if no blocker and cookie disabled then
alert="enable cookies"
else
if blocker enabled and cookie enabled then
alert"disable blocker"
else
if blocker disable and cookie enable then
kill cookie and pop-win self.close

this is what i have so far:

in the main.htm

<%
Response.Cookies("b12a")="1"
%>

<head>
<script>
function checkPop(){
window.open("check.htm","")
}
</script>
</head>
<body onLoad="checkPop()">
<form name="popResult">
<input name="warning" value="Please Turn Off Pop-up blocker">
</form>
</body>


in the pop.htm

<head>
<script>
window.opener.popResult.warning.value="No Pop-Up Killer Detected"
if (document.cookie){
self.close
}
else{
alert="cookies must be enabled"
}
else{
exp = new Date();
exp.setTime(exp.getTime() - (24*60*60*1000));
var cval = getCookie(b12a);
cval = (cval == null) ? "" : cval;
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
self.close()
}
</script>
</head>

Phil Karras
03-28-2003, 02:14 PM
You can check for a cookie by simply attempting to write one and read it back.

As for pop-up blockers I have no idea how to check for them since most are what used to be called "terminate-stay-resident" programs checking things as they try to run.

Not sure JS has any way to do that.