Solved

Reading XML from an Iframe

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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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 …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

770 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