Why does adding http to window open cause problems?

O

OJ

Hi,

This works to maximize the window, but wants to load yahoo locally :
C:\WINDOWS\Desktop\www.yahoo.com

<html>
<script type="text/javaScript">
<!--
function test() {
qwe = window.open("www.yahoo.com","");
qwe.moveTo(0,0);
qwe.resizeTo(screen.availWidth,screen.availHeight);
}
// -->
</script>
<a href = "javascript:void(0)" onClick="test()">test</a>

Adding http:// before the www.yahoo.com opens to yahoo, but IE 5.5
gives an error "access is denied" upon hitting the qwe.moveTo line.

What's the deal-e-o here? Anyone have a clue what I've screwed up?

oj
 
M

Mosley Jones III

OJ said:
Hi,

This works to maximize the window, but wants to load yahoo locally :
C:\WINDOWS\Desktop\www.yahoo.com

<html>
<script type="text/javaScript">
<!--
function test() {
qwe = window.open("www.yahoo.com","");
qwe.moveTo(0,0);
qwe.resizeTo(screen.availWidth,screen.availHeight);
}



I just coped your code,


my guess is that you don't have the permission to mess with a page not in
your domain.
 
M

ManoDestra

You need to specify the protocol you are using. If you don't, the browser
will default to something (in this case, the file: protocol).

I suspect your moveTo problem is because your trying to execute a bit of
JavaScript across domains which is not allowed for security reasons. Try it
on a page within your own domain or from your file system and it should
work.

Peter.
 
M

ManoDestra

I know it's frustrating. It looks on the surface that you should be able to
do it. Unfortunately as soon as you load a page from a different domain into
that window. The window expects javascript from that domain to act on it,
not from your domain whether it is just trying to move the window, or find
out the number of links on the page.

Annoying, but sensible if you think about it from a security point of view.

Peter.
 
O

OJ

ManoDestra said:
I know it's frustrating. It looks on the surface that you should be able to
do it. Unfortunately as soon as you load a page from a different domain into
that window. The window expects javascript from that domain to act on it,
not from your domain whether it is just trying to move the window, or find
out the number of links on the page.

Annoying, but sensible if you think about it from a security point of view.

Peter.

Hey,

So, instead, I will try to open a window with no address, move it and
then document.location it to send it to the other address.

oj
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top