1

I have a situation in which a hidden IFRAME loads a page. The page does not return HTML data but rather a raw JSON string. Since the data is not HTML there is no "body" tag and I can not use the following suggestion that was given in another SO question:

  iFrameBody = iFrame.contentWindow.document.getElementsByTagName('body')[0];

The content of the IFRAME is similar to:

   IFRAME:
   -----------------------------------------------
   |     {"JSON" : "HERE" }                       |
   -----------------------------------------------

   and not

   ------------------------------------------------
   |       <html>                                 |
   |            <body>                            |
   |                 {"JSON" : "HERE" }           |
   |            </body>                           |
   |       </html>                                |
   ------------------------------------------------

I'm basically asking how to get the raw contents of an iFrame. Adding pseudo HTML tags is not an option. Not using an iFrame is not an option. Thanks!

user974896
  • 1,795
  • 4
  • 28
  • 48
  • is your iframe on the same domain as your main page ? – Dominic Green Jan 18 '13 at 14:33
  • yes it is. I have an onLoad event for the IFRAME so if I could get the entire pages html from inside that would work too. I could do parent.processFrame(document.getElementById(????).innerHTML);, but once again I run into the fact that there are no html tags. If I could somehow do a document.getRawPage() that would work but no such function exists. – user974896 Jan 18 '13 at 14:36
  • you mentioned you had to use and iframe, why is this why would you not just run a ajax get on the page ? – Dominic Green Jan 18 '13 at 16:14
  • Support for very old devices. – user974896 Jan 18 '13 at 18:42
  • Possible duplicate of [How to get iframe response headers?](http://stackoverflow.com/questions/17250103/how-to-get-iframe-response-headers) – Paul Sweatte Jan 23 '17 at 17:11

0 Answers0