Solved

How can I access displayed data on one window from another window?

Posted on 2012-03-10
4
294 Views
Last Modified: 2012-03-17
I have a Web application that inserts a record into a database table. After inserting the record successfully, I open a new window that is dynamically built JavaScript in the ASP.NET Code Behind (in C#). In that window, I have an HTML page using Frames that displays 4 pages: header, instructions, results from submitting a form to an external web page, and a footer. In the 3rd page in the Frame set, I am submitting a form containing XML via JavaScript to an external web page that returns some XML with a needed Ticket Number. Thus, the user will always see this Ticket Number in the context of the header & instructions and the footer.

With that as background, is there a way to be able to read and capture the data that is displayed in the 3rd framed window from another window so that I can write this Ticket Number into the database table's record? In general, if I have any kind of window that executes an external web page that provides info such as a ticket number, can I capture that information from some other window so that I can use it and update my record with it?
0
Comment
Question by:dwoolley3
[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
  • 2
4 Comments
 
LVL 22

Expert Comment

by:Kim Walker
ID: 37706934
Theoretically, if all the pages are from the same domain, you can traverse the DOM from one iFrame to another. Javascript in iFrame1 can access the parent which can access the document in iFrame2. If iFrame2 contains a form named "someform" you could access it like.
var iframe2 = parent.document.getElementById('iframe2');
var someFormIniFrame2 = iframe2.document.someform;

Open in new window

Again, this is theoretical. I have often accessed the parent from within the iFrame and the iFrame from the parent, but never from iFrame to iFrame. Also, I must reiterate that they must be in the same domain. Browser security appropriately prevents pages in one domain from accessing pages from another domain.
0
 

Author Comment

by:dwoolley3
ID: 37707635
That is a good response. So, if one of those frames starts out as an html page within the domain and then redirects to an external page (e.g. www.cnn.com), can other frame pages access the data from this other page? Sounds like the browser will not allow it for security reasons.
0
 
LVL 22

Accepted Solution

by:
Kim Walker earned 500 total points
ID: 37707981
That is correct. You would not be able to access the contents of the external page from a page in your own domain.
0
 

Author Closing Comment

by:dwoolley3
ID: 37733829
Thank you for your answer and for your discussion on Frames.
As a result, I abandoned my initial design, and I have successfully rewritten things so that I am able to use the Web Service and Web Methods of the external Web application to perform a process and to obtain its results for posting in my ASP.NET web site.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 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