473,320 Members | 1,846 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,320 software developers and data experts.

Permission denied to get property Location.href

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 = contentWindow.location.href;

If it happens to find a window named 'someWindowName' that currently has a
document loaded from some other host, the "contentWindow.location.href" code
triggers the following error:
Error: uncaught exception: Permission denied to get property
Location.href

I know I could put this code inside a try-catch. However, while I found this
works on IIS5.1 (my testing server), I also found that the version of
Chilisoft I have to use on the production server does not support
try-catch...

So my question is this: how can I avoid the uncaught exception in this case
without using a try-catch?

Thanks for any advice!

Rob
:)
Jul 20 '05 #1
3 41354
Rob,

Your quoted code looks like client-side script, so I'm puzzled as to what
possible effect your hosting server ASP environment might have. Use of
try/catch on the *client* is dependent only on the browser and the js
version it supports....

Tim


"Robert Mark Bram" <re********@removethis.optushome.com.au> wrote in message
news:3f**********************@news.optusnet.com.au ...
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 = contentWindow.location.href;

If it happens to find a window named 'someWindowName' that currently has a
document loaded from some other host, the "contentWindow.location.href" code triggers the following error:
Error: uncaught exception: Permission denied to get property
Location.href

I know I could put this code inside a try-catch. However, while I found this works on IIS5.1 (my testing server), I also found that the version of
Chilisoft I have to use on the production server does not support
try-catch...

So my question is this: how can I avoid the uncaught exception in this case without using a try-catch?

Thanks for any advice!

Rob
:)

Jul 20 '05 #2
Howdy Tim!
Your quoted code looks like client-side script, so I'm puzzled as to what
possible effect your hosting server ASP environment might have. Use of
try/catch on the *client* is dependent only on the browser and the js
version it supports....


Of course you are right - I was thinking about the error message without
thinking about it coming from client side. Ignoring the try-catch issue, the
problem is the same: how can I avoid this error:
Error: uncaught exception: Permission denied to get property

Rob
:)
Jul 20 '05 #3


Robert Mark Bram wrote:
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 = contentWindow.location.href;

If it happens to find a window named 'someWindowName' that currently has a
document loaded from some other host, the "contentWindow.location.href" code
triggers the following error:
Error: uncaught exception: Permission denied to get property
Location.href


Well, you can't change that, as you yourself write the document in the
other window is loaded from some other host, and the same origin policy
prevents script from one host to access properties of pages from another
host. If the hosts are in the same domain e.g.
host1.domain.tld
and
host2.domain.tld
then you can set
document.domain = 'domain.tld'
and the cross frame scripting should work, but if the hosts are in
different domains then there is nothing you can do, unless it is
Mozilla/Netscape where you could work with signed script.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #4

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

Similar topics

1
by: Klunk | last post by:
Hi, last week I moved the folder of my Intranet application to another disk of the same server. After this change all the ASP page return this error: Microsoft VBScript runtime error...
2
by: John Mack | last post by:
Intermittently I get the following error on Firefox: "Error: uncaught exception: Permission denied to get property HTMLDocument.window" What can cause this error? I do an image switch via JS...
1
by: Jake Barnes | last post by:
I can not figure out the meaning of this error: Error: " nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://www.bluecasts.com/pdsIncludes/pdsAjax.js ::...
2
by: laredotornado | last post by:
Hi, I'm trying to use the xmlHttpReq object to contact a URL on my server. But I'm getting a JS "Permission denied" error at the indicated line. What does it mean and how can I get around it? ...
2
by: prays | last post by:
Hi, I have made a script that should check if users on my site are registering to example a newsletter or a contest. But now when i want to check the location in the window, it says permission...
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 { ...
3
by: doby48 | last post by:
I have a JavaScrip that runs fine under all browsers except IE. I am opening up a document within an iframe and I get the error of Permission Denied in IE. I know that IE has security that will throw...
1
by: Mihania | last post by:
Permission denied exception is fired in IE6 on line(9) during the following actions . (1)<html> (2)<head> (3) <title>Simple :: documentDomain :: Cars</title> (4)</head> (5)<body> (6) ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.