Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-16-2007, 05:00 PM   PM User | #1
mic2100
Regular Coder

 
mic2100's Avatar
 
Join Date: Feb 2006
Location: Scunthorpe
Posts: 562
Thanks: 15
Thanked 28 Times in 27 Posts
mic2100 is on a distinguished road
IFRAME content problem

Hi,

I am trying to create a form that allow to me verify user registration details against a government database.

I have a page that exists in an iframe and is submitted via javascript controls in the parent window. This page posts some data to a remote site and then shows the results page. The problem i am having is trying to read the contents of the IFRAME once the page as been submitted.

I can read the contents before the page submit but once it has been done I get an access denied message. if the remote site is a https would that make any differance to it.

Code:
function submitform()
{

	var surname = document.getElementById("surname").value;
	var number = document.getElementById("accreditationNumber").value;
	
	//parent.landmark.onload = function alertIframeContents(){ alert(document.getElementBuId("landmark").innerHtml); };
	
	parent.landmark.document.form1.hiCertNumber.value = number;
	parent.landmark.document.form1.hiSurname.value = surname;
	parent.landmark.document.form1.submit();
	
             setTimeout("alertIframeContents()", 2000);
}

function alertIframeContents()
{
	
	alert(landmark.document.body.innerHTML);

}
This is the jaascript code i have been using. Is there also a better way to detect wen the remote page as loaded, because this is going to be one of my biggest problems.

Thanks

Last edited by mic2100; 06-16-2007 at 05:01 PM.. Reason: spellig mistkes
mic2100 is offline   Reply With Quote
Old 06-16-2007, 06:03 PM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
For security reasons, Javascript cannot access the page in a different domain.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 06-16-2007, 07:18 PM   PM User | #3
mic2100
Regular Coder

 
mic2100's Avatar
 
Join Date: Feb 2006
Location: Scunthorpe
Posts: 562
Thanks: 15
Thanked 28 Times in 27 Posts
mic2100 is on a distinguished road
thank you for your response...

thats shame oh well i suppose i will just have to find a different way.
mic2100 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:10 AM.


Advertisement
Log in to turn off these ads.