iFrame in jQuery mobile application causes error : Unsafe JavaScript attempt to access frame with URL file:///D:/xx/webpage.html from frame with URL http://www.asp.net/. Domains, protocols and ports must match.
I am developing a jQuery mobile application which uses iFrame to load external websites.
My script code is:
$(document).ready(function () {
$('#divID').prepend('<img src="http://xxx/images/ICPosternew1002.png" usemap="#map" id="image" style="margin-top:43px;"/>')
$('#map').append('<area coords="30,0,60,30" id="1" alt="Blah" title="asp" />')
$("#1").bind("click", function (e) {
e.preventDefault();
$('#Web1').append('<form id="form1" runat="server" rel="external"></form>')
$('#form1').append('<iframe id="iframe1" src="http://asp.net" frameborder="0" rel="external"></iframe>')
});
});
I have two virtual pages in my application. On clicking on image map in main page loads the second page with iFrame and the corresponding website.
<div data-role="page" id="Web" class="pagebody">
<div data-role="header" data-position="inline" data-theme="a">
<!--header-->
</div>
<div data-role="content" id="Web1">
<form id="form1" runat="server">
<iframe id="iframe1" >
</iframe>
</form>
</div>
<div data-role="footer" class="footer">
<!--footer-->
</div>
</div>
Is it the problem with my code?