473,378 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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
-------------------------------------------------
Jul 20 '05 #1
6 15868
kaeli wrote:
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>


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 <gw*****@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
Jul 20 '05 #2
In article <3F**************@agricoreunited.com>,
gw*****@agricoreunited.com enlightened us with...
Don't assign a string as an event handler.

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
-------------------------------------------------
Jul 20 '05 #3
"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
<snip>
ScLdAgainWin.onunload=UnLoaded;

<snip>

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

Richard.
Jul 20 '05 #4
In article <bo*******************@news.demon.co.uk>,
Ri*****@litotes.demon.co.uk enlightened us with...
"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
<snip>
ScLdAgainWin.onunload=UnLoaded;

<snip>

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


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
-------------------------------------------------
Jul 20 '05 #5
"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
<snip>
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.


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.
Jul 20 '05 #6
In article <bo*******************@news.demon.co.uk>,
Ri*****@litotes.demon.co.uk enlightened us with...

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.

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.
If all else fails, have you considered branching on
window.addEventListener and using that for onunload if available?


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
-------------------------------------------------
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Robert Mark Bram | last post by:
Hi All! I have a piece of JavaScript that attempts to find the location.href property of another window. For example: contentWindow = window.open('', 'someWindowName'); var otherUrl =...
6
by: Adrian Parker | last post by:
Using asp.net 2003 When I use document.attachEvent("onmousemove", resetTimer); The first time into a page, it works fine, but the 2nd time the page is loaded (not postback) it gives a...
21
by: alistair_henderson | last post by:
Morning All, I have some code for a website which uses 'window.open' to simulate modal dialog boxes. I use the window.closed property to decide if the window object exists at various points. ...
4
by: MrGado | last post by:
Running on Windows XP with Mozilla 2.0.0.4, I am experiencing a strange security issue. function loadXMLDoc(url,funcname) { try { ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.