Bypassing Security Restrictions for Internet Explorer

D

Dave

Hi all,
I write this javascript code in a html page:

function inscript()
{
var frame = document.getElementById("myframe");
frame.contentWindow.document.createElement('script');
scr.type = 'text/javascript';
scr.text = 'alert("hello")';
frame.contentWindow.document.body.appendChild(scr);
}

In the same page there is a IFRAME that invoke the javascript code:

<iframe src="http://www.google.it" frameborder="0" align="top"
width="100%" height="100%" id="myframe" onload="inscript()">


Loading this page, Internet Explorer generates an error Message:
"Access Denied", because
the javascript try to mod the DOM of a web page with another domain
(www.google.it).


This problem can be solved in Mozilla Firefox adding this
instruction:

netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

in javascript code.


Please help me find a solution for IE.

Thank You
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top