Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    dJogja id
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SetAttribute Remote Window and Iframe preload

    I need setAttribute "src" from main windows to pop-up window (Iframe in it) and also i need to prepload all src files ONCE, so if user ever click to open pop-up and do it againt, its no need to loading againt, can anybody help with the script ... ? Or maybe can sugest me with better method to have same result. thanks.

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    If you only want to load the document once, I'd suggest looking into XMLHttpRequest, both IE and Gecko have implementations of it, though I'm not sure about loading non-XML docs (XHTML counts as XML remember, with the proper mime-type).

    Anyway, say 'newWin' is the variable you assigned the results of window.open() to, I'd imagine something like:

    newWin.document.getElementsByTagName('iframe').item(0).setAttribute('src', 'newsrc');

    Where the iframe is the first iframe in the new window's document would work - as long as the main window and popup window exist on the same domain. Otherwise you will get some cross-domain scripting errors.

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    dJogja id
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    BTW i still try to looking without XMLHTTPRequest.
    plz let me know if you have something relevan..plz. thankzzz.

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    I'm not sure of any way to cache an HTML or XML document reliably without XMLHttpRequest (store it as an object).

    I mean, you can preload images by loading them once with new Image(), perhaps if you just change the src once, it also stays in cache?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •