Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts

    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 06:01 PM. Reason: spellig mistkes

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    For security reasons, Javascript cannot access the page in a different domain.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    thank you for your response...

    thats shame oh well i suppose i will just have to find a different way.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •