Connecting Tech Pros Worldwide Help | Site Map

permission denied to set property window.onunload

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 11:35 AM
kaeli
Guest
 
Posts: n/a
Default permission denied to set property window.onunload


Hey guys,

This error occurs ONLY in Netscape 7.0. Not in 7.1. So, I think it's a
bug. Buuuut...

Has anyone had this problem or know of a fix?

When attempting to have an onunload function set with "window.onload=",
the error comes up
"permission denied to set property window.onunload"

I can't find a thing on this one. Setting it with the normal "<body
onunload" works fine. But isn't a great thing for me to do, since the
onload is part of a very large menu script.

Here's a test page to illustrate the problem. Netscape 7.0 has a problem
with this. 7.1 does not. IE is fine, too.

<html>
<head>
<title> New Document </title>
<script>
window.onunload="alert('bye bye');"
</script>
</head>

<body>
test
</body>
</html>


-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------

  #2  
Old July 20th, 2005, 11:36 AM
Grant Wagner
Guest
 
Posts: n/a
Default Re: permission denied to set property window.onunload

kaeli wrote:
[color=blue]
> Hey guys,
>
> This error occurs ONLY in Netscape 7.0. Not in 7.1. So, I think it's a
> bug. Buuuut...
>
> Has anyone had this problem or know of a fix?
>
> When attempting to have an onunload function set with "window.onload=",
> the error comes up
> "permission denied to set property window.onunload"
>
> I can't find a thing on this one. Setting it with the normal "<body
> onunload" works fine. But isn't a great thing for me to do, since the
> onload is part of a very large menu script.
>
> Here's a test page to illustrate the problem. Netscape 7.0 has a problem
> with this. 7.1 does not. IE is fine, too.
>
> <html>
> <head>
> <title> New Document </title>
> <script>
> window.onunload="alert('bye bye');"
> </script>
> </head>
>
> <body>
> test
> </body>
> </html>[/color]

Don't assign a string as an event handler.

window.onunload = function() {
alert('bye, bye');
}

works, as would:

function myOnunload() {
alert('bye, bye');
}
window.onunload = myOnunload;

--
| Grant Wagner <gwagner@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html


  #3  
Old July 20th, 2005, 11:36 AM
kaeli
Guest
 
Posts: n/a
Default Re: permission denied to set property window.onunload

In article <3FA94CED.DA2C778@agricoreunited.com>,
gwagner@agricoreunited.com enlightened us with...[color=blue]
> Don't assign a string as an event handler.
>[/color]


The original didn't.
This was just for testing.

You don't want to see the whole thing. :)

Here's the one line from the original source, in case it makes sense by
itself.

ScLdAgainWin.onunload=UnLoaded;

(UnLoaded is a defined function - again, this code works fine in all
other target browsers, including IE5+, NN6.2, and NN7.1)

If you want the whole source, it's HVMenu from dynamicdrive.com. I've
been using it for some time, but it was only tested up to NN6.2. I
checked for updates, but there were none. I may decide to contact the
author, but if this is a browser bug, I don't want to bother.

-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
  #4  
Old July 20th, 2005, 11:37 AM
Richard Cornford
Guest
 
Posts: n/a
Default Re: permission denied to set property window.onunload

"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a130ecd2cda7c75989950@nntp.lucent.com...
<snip>[color=blue]
> ScLdAgainWin.onunload=UnLoaded;[/color]
<snip>

Is this assigning a reference to a function defined in the current
window to a property of a pop-up?

Richard.


  #5  
Old July 20th, 2005, 11:38 AM
kaeli
Guest
 
Posts: n/a
Default Re: permission denied to set property window.onunload

In article <bocd0h$ate$1$8300dec7@news.demon.co.uk>,
Richard@litotes.demon.co.uk enlightened us with...[color=blue]
> "kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
> news:MPG.1a130ecd2cda7c75989950@nntp.lucent.com...
> <snip>[color=green]
> > ScLdAgainWin.onunload=UnLoaded;[/color]
> <snip>
>
> Is this assigning a reference to a function defined in the current
> window to a property of a pop-up?
>[/color]

No, the code is running from a frameset. It is addressing the main
frame. That doesn't matter, though, since it doesn't work in a regular
page, either.

It doesn't work no matter where you put it, which was what I was showing
in the little test page I posted. It won't let you assign anything to
onunload with script, it has to be in the body tag. Again, this works in
every browser I need it to work in except NN7.0. NN7.1 it works fine.
NN7.0 throws a security exception.


-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
  #6  
Old July 20th, 2005, 11:38 AM
Richard Cornford
Guest
 
Posts: n/a
Default Re: permission denied to set property window.onunload

"kaeli" <tiny_one@NOSPAM.comcast.net> wrote in message
news:MPG.1a14113cdf1e7365989953@nntp.lucent.com...
<snip>[color=blue]
>It doesn't work no matter where you put it, which was what I
>was showing in the little test page I posted. It won't let
>you assign anything to onunload with script, it has to be in
>the body tag.[/color]

As Grant said, your original test page wasn't going to work because it
was assigning a string instead of a function. But testing:-

<html>
<head>
<title></title>
<script>
function UnLoaded(){alert('bye bye');}
window.onunload=UnLoaded;
</script>
</head>
<body>
test
</body>
</html>

- worked with (Windows) Netscape 7.00 & 7.02 both from the local file
system and over an HTTP server.

If all else fails, have you considered branching on
window.addEventListener and using that for onunload if available?

Richard.


  #7  
Old July 20th, 2005, 11:38 AM
kaeli
Guest
 
Posts: n/a
Default Re: permission denied to set property window.onunload

In article <bodo0n$sfb$1$8300dec7@news.demon.co.uk>,
Richard@litotes.demon.co.uk enlightened us with...[color=blue]
>
> As Grant said, your original test page wasn't going to work because it
> was assigning a string instead of a function. But testing:-
>
> <html>
> <head>
> <title></title>
> <script>
> function UnLoaded(){alert('bye bye');}
> window.onunload=UnLoaded;
> </script>
> </head>
> <body>
> test
> </body>
> </html>
>
> - worked with (Windows) Netscape 7.00 & 7.02 both from the local file
> system and over an HTTP server.
>[/color]

Not on ours.
I have 2 users who test for me, and they have 7.0, and this gave the
same error.

I wonder if it's something in their settings...
Neither has a user.js file that I could find. I know people can turn off
onunload with a setting in that file, but neither of them have that.
[color=blue]
> If all else fails, have you considered branching on
> window.addEventListener and using that for onunload if available?
>[/color]

I already did a workaround, but it was icky. I put the function call in
the onunload event of each body tag of every damn page (thank goodness
for dreamweaver templates!).

addeventlistener for onunload did the same error for their browsers.

This wouldn't be that big of a deal if we didn't have a ton of Netscape
users. *sigh*

-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.