How to get innerhtml from iframe from another web application

Hello Experts,

I manage multiple web-based database applications.
I'm trying to get data from one application and insert the data into another application on completely different domains/websites.

What I did is create an iframe on the destination application.  The iframe logs into the other application and grabs the data I want and displays the data as insert statements in the iframe.

I then have a Javascript on a button to attempt to get  the innerhtml of the body tag of the iframe.
When I try to do this I get an Access is denied.  I did some research on this and it's because the ifrmae is from a different domain than the destination application.

Does anyone have any suggestions on how I can do something like this?

Both applications use Tomcat and the applications are written in JSP.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

My suggestion would be to have the first application fetch the insert data directly from the second application. The first application can then either display the insert data on the result page for confirmation, or simply insert the data and display the final result.

If you need to display the confirmation page, I'd also have the application keep a copy of the inserts, so when the confirmation is returned, you won't need to parse the data from the page and it should eliminate any need for javascript.

Also, if you really need to solve this problem with javascript (which might be true if the two JSP applications can not talk to each other), it would be better asked in the javascript zone.

I don't javascript will help you here. Your up againest the security issue. Look at
One app can make a request ( using a object or a JSTL import tag) to a servlet or a JSP in the other app.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
b0lsc0ttIT ManagerCommented:
The expert above is right.  This won't work using ANY clientside script.  Browsers prevent it for security reasons like those that expert mentioned.  I just wanted to confirm this as a javascript expert.  All credit to the expert above for pointing out it can't be done.
You will have to use server script to get the contents from another domain.  If this page is on your server then an "AJAX" script could be used to load it in the page without reloading the whole page.  If this is done when the page loads then just have the main server script get the contents.  I am not a JSP expert but I am sure it has something like curl or WebClient that will let you "scrape" the contents from another site (i.e. make an http request to a URL and get the response).  A server page can do this without a security problem.  Of course make sure doing this doesn't violate the terms of use, etc from the other site. :)
If you have a question about this please let me know.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java App Servers

From novice to tech pro — start learning today.