Solved

Reading XML from an Iframe

Posted on 2009-05-13
3
549 Views
Last Modified: 2013-11-19
I have a page with an Iframe in it. (see http://www.datacollaborative.com/qbn/map/m2.cfm) I need for a script on the main page to read the content in the iframe. One complication is that the iframe is just XML - no formatting, no XSL stylesheet. I just need to read the XML.

I could accomplish the same thing with an AJAX call, except the XML is coming from a different domain so I can't do AJAX.

I can deal with parsing the XML once I get it. I just need some way of getting it. I tried window.frames[0].document.innerHTML, and that did not work. I tried some other things too but have gotten nowhere.
<iframe height="200" width="200" src="https://www.quickbase.com/db/main?a=api_GrantedDBs" id="ifr1"></iframe>
<script>
alert(window.frames[0].document.innerHTML)
</script>

Open in new window

0
Comment
Question by:DataCollab
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 24374893
It is the "coming from another domain" which will also block you from accessing it in an iframe

read it on the server instead
0
 

Author Comment

by:DataCollab
ID: 24374993
That's unfortunate.
The problem is that I need a cookie that is on the client computer in order to access the XML. I gues that is probably considered a security breach, which is why the restriction you mentioned exists.
I am going to accept your response as the solution, but do you have any suggestions on another way for a page in domain A to read the contents of a page in domain B, when the page in domain B is only accessible with a cookie on the client computer?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24375089
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question