0

In my asp.net application i am trying to enlarge an image which is in a iframe, as shown below

<head id="Head1" runat="server">
    <script type="text/javascript">
        function showbigimg(){
            alert('works');
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">

        <%--Other page controls--%>

        <iframe id="htmliframe">                
            <html>
                <head></head>
                <body>
                    <a href="#" onclick="parent.showbigimg();">
                        <img src="../someimage.png"/>
                    </a>
                </body>
            </html>
        </iframe>
    </form>
</body>

When i click on the image in iframe i get this Access Denied in IE and Permission denied to access property in FF.

Am i doing it in the right way or is there an alternate method.

EDIT: I will place a div in parent HTML with an img with enlarged size, when showbigimg is called

prvn
  • 406
  • 3
  • 7
  • 24
  • I guess I never fully understood this, but if you put HTML inside of an ` – Ian Apr 05 '13 at 14:49
  • Actually i have done the same, where i dont merely put the HTML inside the iframe but specify the source(src), eventually that is how it is going to look when i run the application. – prvn Apr 05 '13 at 14:54
  • I took reference from this post http://stackoverflow.com/questions/3615141/calling-a-function-in-parent-file-from-child-frame – prvn Apr 05 '13 at 14:55
  • Oh you're definitely right that this is valid and should work (especially if in a separate file and using the `src` attribute). Are you doing this all locally? Like what's the protocol of the URL you're using? Is it `file://` or `http://`? – Ian Apr 05 '13 at 15:24
  • @Ian Yes, I'm running the application locally(localhost) from visual studio IDE, and URL its https:// – prvn Apr 08 '13 at 07:32
  • @Ian going through other post i realized that it cannot be done due to CORS. The source of iframe is of different source & because of security it cannot be done, for further information refer http://stackoverflow.com/questions/12044771/access-parent-from-iframe-even-though-domains-dont-match – prvn Apr 08 '13 at 09:43

0 Answers0