Why does adding http to window open cause problems?

Discussion in 'Javascript' started by OJ, Jul 23, 2003.

  1. OJ

    OJ Guest

    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
     
    OJ, Jul 23, 2003
    #1
    1. Advertising

  2. "OJ" <> wrote in message
    news:...
    > 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.




    > // -->
    > </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
     
    Mosley Jones III, Jul 23, 2003
    #2
    1. Advertising

  3. OJ

    ManoDestra Guest

    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.
    "OJ" <> wrote in message
    news:...
    > 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
     
    ManoDestra, Jul 24, 2003
    #3
  4. OJ

    ManoDestra Guest

    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.
    "OJ" <> wrote in message
    news:...
    > "Mosley Jones III" <> wrote in message

    news:<3f1e1713$>...
    > > "OJ" <> wrote in message
    > > news:...
    > > > 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.

    >
    > Hi,
    >
    > I'm not messing with it. The browser should only care about moving
    > the window, not what's in it.
    >
    > oj
    > >
    > >
    > >
    > >
    > > > // -->
    > > > </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
     
    ManoDestra, Jul 24, 2003
    #4
  5. OJ

    OJ Guest

    "ManoDestra" <> wrote in message news:<BcGTa.652$>...
    > 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

    > "OJ" <> wrote in message
    > news:...
    > > "Mosley Jones III" <> wrote in message

    > news:<3f1e1713$>...
    > > > "OJ" <> wrote in message
    > > > news:...
    > > > > 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.

    > >
    > > Hi,
    > >
    > > I'm not messing with it. The browser should only care about moving
    > > the window, not what's in it.
    > >
    > > oj
    > > >
    > > >
    > > >
    > > >
    > > > > // -->
    > > > > </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
     
    OJ, Jul 25, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sara Khalatbari
    Replies:
    6
    Views:
    351
    Jeff Shannon
    Mar 16, 2005
  2. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    989
    Mark Rae
    Dec 21, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,249
    Smokey Grindel
    Dec 2, 2006
  4. Dan Kohn
    Replies:
    0
    Views:
    111
    Dan Kohn
    Jan 19, 2006
  5. sdvoranchik
    Replies:
    1
    Views:
    154
    Thomas 'PointedEars' Lahn
    Jan 31, 2004
Loading...

Share This Page