www.webdeveloper.com
Results 1 to 14 of 14

Thread: DOCUMENT Object of Empty Frame?

  1. #1
    Join Date
    Mar 2008
    Posts
    20

    Question DOCUMENT Object of Empty Frame?

    I need to change an empty sibling frame's location. Since that's asynchronous (or can I change this?), I instead need to assign the source code of a webpage retrieved by an XMLHTTPREQUEST to the entire document. Since DOCUMENT.ALL isn't well supported, what is?

    I tried DOCUMENT.WRITE(), but it adds an extra history index!

    I also tried asssigning to a <DIV>, but aren't two nested <HTML> elements a bad thing?

  2. #2
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    you can just as easily use synch.

    xrt.open( "GET", url, false )

    if you can find the document object, you can set the .innerHTML of the documentElement, or a firstChild, and hope that the head tag info is parsed correctly.

    outside of IE, you can create a dataURL from your responseText and set the iframe's .src to that data url.

  3. #3
    Join Date
    Mar 2008
    Posts
    20
    Thank you for your quick response, but, to clarify, my script and stuff is in a frame, not an iframe. A frameset holds this and another, empty frame, which is the aforementioned 'sibling frame'.
    Last edited by zenoxman; 08-19-2008 at 02:47 PM.

  4. #4
    Join Date
    Apr 2006
    Location
    Houston
    Posts
    1,374
    If you have a URL then a "location.replace" will page switch without placing the current page in the history list:
    http://stansight.com/WordPress/2007/...acing-history/

  5. #5
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    since you are displaying the whole source of a file in a frame, why not simply point the frame to the same url that you ajax?

  6. #6
    Join Date
    Mar 2008
    Posts
    20
    Because, as my first post stated, changing a frame's SRC or LOCATION is asynchronous, and using a loop to wait for everything to load freezes everything up, even with setTimeOut()...

    P.S. This is the third time I have had to start a thread in order to be near the front of the forum and BE NOTICED, but before anyone thinks to answer my question directly, no one sees me on page 6.

    So please, someone, answer my first post?
    Last edited by zenoxman; 08-19-2008 at 08:18 PM.

  7. #7
    Join Date
    Apr 2006
    Location
    Houston
    Posts
    1,374
    "I need to change an empty sibling frame's location...."

    Your first sentence, which I answered. Thanks for the rude reply when I was trying to help.

    "...changing a frame's SRC or LOCATION is asynchronous..."

    That makes absolutely no sense what so ever. A location can not be asynchronous. It sounds like you are confused about what you want and how to go about doing it and are blaming others for your inability to express your self clearly and concisely.

    P.S.

    If you are using "XMLHTTPREQUEST" to retrieve the source code of a web page. Then either you are page scraping to steal someone's source code, which resides on another server, OR you don't know how to assign a page to a hidden iframe and grab the innerHTML of that.
    Last edited by slaughters; 08-19-2008 at 09:43 PM.

  8. #8
    Join Date
    Mar 2008
    Posts
    20
    double post -_-
    Last edited by zenoxman; 08-21-2008 at 01:57 PM.

  9. #9
    Join Date
    Mar 2008
    Posts
    20

    Unhappy

    Sorry, slaughters. What I meant when I said

    "...changing a frame's SRC or LOCATION is asynchronous..."

    was that doing

    parent.document.frame1.src = [location];

    or

    parent.document.frames[1].window.location = [location];

    forces me to wait in a loop, which hasn't worked for me.

    I will check back here occasionally to see if anyone has deciphered my posts and were able to help me, but for now, I'm moving on, as this history problem shouldn't drive too many users away from my search engine.

    Thank you all!

    P.S. slaughters, I prefer not to use iframes because they aren't well-supported.

    And do you call Google a source code thief?
    Last edited by zenoxman; 08-21-2008 at 01:58 PM.

  10. #10
    Join Date
    Apr 2006
    Location
    Houston
    Posts
    1,374
    Quote Originally Posted by zenoxman
    ...
    P.S. slaughters, I prefer not to use iframes because they aren't well-supported....
    That is totally wrong. As far as I am aware iframes are well supported in every major browser.

    I expect your issue is that you want to scrape the information from the source of web pages that do not reside on your server. Iframes will display external pages, but you are blocked from getting their innerHTML unless they are on the same server.

    Once again. It's real hard to understand what you want help with. You change your statements with each post and the things you do say make no sense ("DOCUMENT.WRITE()" changes the history list ?).

    This is why no one is able to help you. This is why this is my last post to this thread.

  11. #11
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    Quote Originally Posted by slaughters
    That is totally wrong. As far as I am aware iframes are well supported in every major browser.
    what about XHTML?

  12. #12
    Join Date
    Mar 2008
    Posts
    20
    Quote Originally Posted by slaughters
    You change your statements with each post and the things you do say make no sense ("DOCUMENT.WRITE()" changes the history list ?).
    I think my problem is that I don't explain myself fully in a single post. And DOCUMENT.WRITE() adds to the browser history.

  13. #13
    Join Date
    Apr 2006
    Location
    Houston
    Posts
    1,374
    Quote Originally Posted by rnd me
    what about XHTML?
    Not a browser last time I checked

    I don't design in XHTML, so I may be wrong, but from quick googling it looks like the iframe tag works in XHTML transitional, but not XHTML 1.0 Strict. In Strict you are supposed to use the object tag with a mime type of "text/html"

    (Q: is the object tag actually supported in HTML 4.01 Transitional or Strict ?)

    P.S.

    Thanks to "rnd me" for posing an interesting enough query that I broke my promise about coming back to this thread.

    P.P.S.

    Personal Opinion - DOCTYPE's blow chunks.

  14. #14
    Join Date
    Mar 2008
    Posts
    20
    Still, don't iframes also force you to wait in a loop when you change the SRC or LOCATION?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles