Web Analytics Made Easy -
StatCounter SetAttribute Remote Window and Iframe preload - CodingForum

Announcement

Collapse
No announcement yet.

SetAttribute Remote Window and Iframe preload

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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.
    jasonkarldavis.com

    Comment


    • #3
      BTW i still try to looking without XMLHTTPRequest.
      plz let me know if you have something relevan..plz. thankzzz.

      Comment


      • #4
        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?
        jasonkarldavis.com

        Comment

        Working...
        X