Access denied for location?

A

Aaron

Hi,

For some reason, when I create a new window using "myWin =
window.open(url)", and then try to get the location of the window using
"alert(myWin.location)", it tells that access is denied. How can it be
denied...it's a window I created...therefore, shouldn't I have access to
it's location property?

Thanks,
Aaron
 
H

Hywel Jenkins

Hi,

For some reason, when I create a new window using "myWin =
window.open(url)", and then try to get the location of the window using
"alert(myWin.location)", it tells that access is denied. How can it be
denied...it's a window I created...therefore, shouldn't I have access to
it's location property?

The domain in the newly opened window is different from that of the
original window.
 
A

Aaron

I understand what you're saying about security...but I'm reading O'Reilly's
Javascript: The Definitive Guide to learn this (which is supposedly a good
book), and there's a specific example where the location of another window
(another frame in the same set) is obtained and written into the a text box
of the current document. Why would this even be written if it's not
possible?
Also, I get the access denied message when I try to use a self-created "back
button" in one frame to control another frames location via it's history
object. This is in the book too, and it should work. Any ideas?

Thanks,
Aaron
 
R

Richard Formby

Aaron said:
I understand what you're saying about security...but I'm reading O'Reilly's
Javascript: The Definitive Guide to learn this (which is supposedly a good
book), and there's a specific example where the location of another window
(another frame in the same set) is obtained and written into the a text box
of the current document. Why would this even be written if it's not
possible?

You believe *everything* you read?
Also, I get the access denied message when I try to use a self-created "back
button" in one frame to control another frames location via it's history
object. This is in the book too, and it should work. Any ideas?

The book is wrong.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top