Solved

Reading XML from an Iframe

Posted on 2009-05-13
3
548 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

839 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