Closed Thread Icon

Topic awaiting preservation: javascript: access denied.... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8904" title="Pages that link to Topic awaiting preservation: javascript: access denied.... (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: javascript: access denied.... <span class="small">(Page 1 of 1)</span>\

 
Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 10-13-2003 18:31

I've snagged some code that was working. When I try to run it locally, I get an 'access denied' message, and can't figure out why. This code runs in a frame that's in the middle of the page. Here is the particular function:

code:
var strScrollWarning = "Please read through this document before accepting it." +
"\nYou MUST scroll down to the end of the document before hitting the AGREE button";
var is_ie5 = navigator.appVersion.indexOf("MSIE") >= 5;
var is_ns6 = navigator.appVersion.indexOf("Navigator") >= 6;
function HasUserReadIt(){
var SecWin = parent.frames["SecAgree"];
if(is_ie5) {
var SecBody = SecWin.document.body;
var iScrollDiff = SecBody.scrollHeight - SecBody.offsetHeight ;
if ( SecBody.scrollTop < iScrollDiff - 100 ) {
alert(strScrollWarning);
return false;
}
else
{
if(top != self.parent);
frmLoop.target="_parent";
return true;
}
}
else //netscape 4 +
{

var pageYOffset = SecWin.pageYOffset;
var innerHeight = SecWin.innerHeight;

if ( pageYOffset > innerHeight) {
if(top != self.parent);
document.frmLoop.target="_parent";
return true;
}
else
{
alert(strScrollWarning);
return false;
}
}
}



The line generating the error is the one that reads if(is_ie5) {.

Help?

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 10-13-2003 20:00

Never mind. It turned out that it was attempting to access a file on another domain. Resolved!

Nevel
Bipolar (III) Inmate

From: Amsterdam
Insane since: Jun 2002

posted posted 10-13-2003 20:12

Well,

I can imagine multi-frame scripting generating an access-error(here we go again! ), but your problem is definitely not the if-statement. I assume you're testing with IE? If so, try Mozilla, it'll most likely blame another line.
I suspect your access-error is triggered through this line:
var SecWin = parent.frames["SecAgree"];
or this one:
var SecBody = SecWin.document.body;

1. Does this frame in which you're running the script have a frame-sibling called 'SecAgree'? If so:
2. Write a getter for the SecAgree-frame which returns its own body. That way, you are not directly calling some "protected" properties of that frame, but merely calling one of it's functions, which is always granted.
So SecAgree needs a function like:
getBody(){ return document.body; }
which can be used from outside.

Nevel
Bipolar (III) Inmate

From: Amsterdam
Insane since: Jun 2002

posted posted 10-13-2003 20:13

O, ok

« BackwardsOnwards »

Show Forum Drop Down Menu