Problems referencing frame containing external page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Morten Thorsen

    Problems referencing frame containing external page


    Hi frame experts c",) Hope you can help me out on this one

    I've got a frameset (index.html) on my server (server A) defining two
    frames. Left frame is named "menu" and contains a page (menu.html) which is
    located on the same server while right frame is named "main" and contains a
    page (main.html) which is located on another server (server B). This page
    has a form named "f" with an element named "id". I want to access/read the
    value of this element from the left frame, but I get an access denied error.
    Can anybody please help me!

    Just to test, I've put an exact copy of the page on server B, onto server A,
    and then I have no problems accessing the value. I use the following code:

    window.parent.m ain.f.id.value

    I've also tested the frame structure (see the code below the line). When the
    page in the right frame is located on server B, it seems like the whole
    reference to the right frame is lost.

    I also get the same results if I put all three documents on my computer and
    fire up the site with http://localhost/index.html and set the right frame
    source to http://127.0.0.1/main.html

    I use IE

    Any help is appreciated c",) Thanks!

    Best regards Morten.

    ----------------------------------------------------------------------------
    --------------

    Show Frame Structure

    1. Visit any web site with frames
    2. Paste the following into the browser addressbar (remove any line breaks)
    3. Watch a window popup which shows the frame heirarchy of the page being
    visited

    javascript:func tion
    dt0(W,N,fo,i){f o=eval(N);W.doc ument.write('<l i>'+fo.name+'['+fo.document.t it
    le+'-'+fo.document.l ocation.pathnam e+']');if(fo.length >0){W.document. write('
    <ul>');for(i=0; i<fo.length;i++ ){dt0(W,N+'.fra mes['+i+']',undefined,0); }W.doc
    ument.write('</ul>');}};functi on
    dt(W,N){W.docum ent.clear();W.d ocument.write(' <ul>');dt0(W,N, undefined,0);W. d
    ocument.write(' </ul>');W.focus() ;};function
    s(){window.open ('','W').close( );W=window.open ('','W','height =500,width=500, r
    esizable');dt(W ,'top');};s()

    ----------------------------------------------------------------------------
    --------------


  • Martin Honnen

    #2
    Re: Problems referencing frame containing external page



    Morten Thorsen wrote:

    [color=blue]
    > I've got a frameset (index.html) on my server (server A) defining two
    > frames. Left frame is named "menu" and contains a page (menu.html) which is
    > located on the same server while right frame is named "main" and contains a
    > page (main.html) which is located on another server (server B). This page
    > has a form named "f" with an element named "id". I want to access/read the
    > value of this element from the left frame, but I get an access denied error.[/color]

    Yes, browsers implement the same origin policy for scripts to prevent
    you from loading a bank login site for instance and then sniff login
    data. Unless you have host1.domain.tl d and host2.domain.tl d where you
    can then set
    document.domain = 'domain.tld'
    in script to allow the access there is nothing you can do besides using
    a HTML application (.hta file) for instance on Windows


    or using local pages with Mozilla and then let your script request the
    privilege to access the other page.
    --

    Martin Honnen


    Comment

    • Morten Thorsen

      #3
      Re: Problems referencing frame containing external page

      Ok. Thanks for your quick and educational answer. I now understand that it's
      probably for the best that we're unable to do such references. In this
      particular case, I'd sure liked to be able to do it though c",) I don't know
      much about the other two solutions of yours, but I guess the result would be
      a private, local service and not a public web service. Right?

      Morten.

      "Martin Honnen" <mahotrash@yaho o.de> skrev i melding
      news:40d6e664@o laf.komtel.net. ..[color=blue]
      >
      >
      > Morten Thorsen wrote:
      >
      >[color=green]
      > > I've got a frameset (index.html) on my server (server A) defining two
      > > frames. Left frame is named "menu" and contains a page (menu.html) which[/color][/color]
      is[color=blue][color=green]
      > > located on the same server while right frame is named "main" and[/color][/color]
      contains a[color=blue][color=green]
      > > page (main.html) which is located on another server (server B). This[/color][/color]
      page[color=blue][color=green]
      > > has a form named "f" with an element named "id". I want to access/read[/color][/color]
      the[color=blue][color=green]
      > > value of this element from the left frame, but I get an access denied[/color][/color]
      error.[color=blue]
      >
      > Yes, browsers implement the same origin policy for scripts to prevent
      > you from loading a bank login site for instance and then sniff login
      > data. Unless you have host1.domain.tl d and host2.domain.tl d where you
      > can then set
      > document.domain = 'domain.tld'
      > in script to allow the access there is nothing you can do besides using
      > a HTML application (.hta file) for instance on Windows
      >
      >[/color]
      http://msdn.microsoft.com/library/de...node_entry.asp[color=blue]
      > or using local pages with Mozilla and then let your script request the
      > privilege to access the other page.
      > --
      >
      > Martin Honnen
      > http://JavaScript.FAQTs.com/
      >[/color]


      Comment

      • Martin Honnen

        #4
        Re: Problems referencing frame containing external page



        Morten Thorsen wrote:

        [color=blue]
        > I don't know
        > much about the other two solutions of yours, but I guess the result would be
        > a private, local service and not a public web service.[/color]

        You can offer an HTA (HTML application) on a public web server but the
        user then has to download it like a normal application to run it.

        --

        Martin Honnen


        Comment

        Working...