Results 1 to 6 of 6
  1. #1
    bratek
    Guest

    [java script] working with frames

    Hi!
    I have 2 frames! In one of them I laod remote site using header().
    In second frame I have script which have to read first site source, and load it into variable.
    I used something like this:

    var zmienna = parent.frame_name.document.getElementsByTagName('html')[0].innerHTML

    But this line works only if site in first frame was in the same serwes as site in frame 2.

    Does anybody know solution of this problem?
    Thanks

  2. #2
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    This is a security feature of JavaScript - you can't do this sort of thing between different servers. It will only work when both frames are on the same server.

    It's possible you might be able to send variables from one page to the other by linking to the page with a query string (mypage.html?myvar=value), but without knowing more about your situation I really don't know if this would be a solution.
    Dave Owen
    MediaCollege.com

  3. #3
    bratek
    Guest
    Well. It wouldn't be a solution because I want to load site source into the variable, and this site have to be display using header() finction. I know how to send variables between sites, but I don't know how to load my variable
    So is it possible to do something like this?

  4. #4
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    No. Assuming I understand you correctly there is no way to do this. JavaScript can't read the source of a page on a different server.
    Dave Owen
    MediaCollege.com

  5. #5
    bratek
    Guest
    So is any other way to achieve this? Maybe flash?
    But remember that I have to execute site using header().
    Thanks

  6. #6
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    Not that I'm aware of. Flash has the same type of "this server only" restrictions. It's quite important for security.

    Sorry I don't have any other suggestions.
    Dave Owen
    MediaCollege.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Subscribe to us on YouTube