Click here to Skip to main content
13,143,185 members (66,081 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
i have a html page with iframe having login input n password and submit button...... now how i determine on my parents page that the submit of iframe is called or the submit on parent page is called ......
Posted 19-Dec-12 2:26am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hello, please follow this sample:

Parent page:

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
 
      <script type="text/javascript">
 
          function alert_me() {
              alert('hello this is parent');
 
          }
      </script>
 </head>
 <body>
 <iframe src="iframePage.aspx" width="800px" height="600px">
 </iframe>
 </body>
</html>



Iframe Page( Child Page):

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 
    <script type="text/javascript">
 
        function ClickMe() {
            parent.alert_me('hello there!');
        }
    </script>
 </head>
    <body>
        <br/>
        <br/>
        <input type="button" value="Click me" id="button_click" onclick="ClickMe()"/>
    </body>
</html>
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

This looks not too honest to me. If both sources are yours, avoid using iframe. But look around on the following urls...

First consult the "same origin policy": http://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_DOM_access[^].

Than read the really exhaustive tutorial here: http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy[^], and maybe watch this screencast too. http://alexsexton.com/blog/2011/06/breaking-the-cross-domain-barrier-screencast/[^]
  Permalink  
Comments
vaibhavraidwivedi 19-Dec-12 8:50am
   
both on same domain

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100