...

View Full Version : permission exception when access to frame content



DnKrozz
09-25-2005, 11:06 AM
I need my script to analyze some external web page content

I use iframe to load this page and try to get content by this code:


var iframe = document.getElementById("loadFrame");

var text = iframe.contentWindow.document.body.innerHTML;

And I get exception "Error: uncaught exception: Permission denied to get property HTMLDocument.body" in Firefox Browser.

How i can bypass this problem ?

Or what another way to get content of external page ?

martin_narg
09-25-2005, 12:29 PM
It is a cross-domain security issue that you are encountering. Try looking into xmlhttp (http://www.w3schools.com/xml/xml_http.asp) for a cross-domain solution.

m_n

DnKrozz
09-25-2005, 02:38 PM
Thank you for this usefull link. I found many intresting things on it.

But XMLHTTP solution works only on my IE6.
On Firefox i have permission exception again, when i use external link.

Maybe firefox have settings to switch off permission ?

Probably I will have to back to php and socket's for getting content.

This needs a local web server but i want standalone page.

Also, some pages have https protocol and I don't want to implement it in php code.

DnKrozz
09-25-2005, 03:08 PM
I temporary resolve problem using mozilla user.js file with setting:

user_pref("capability.policy.default.XMLHttpRequest.open", "allAccess");



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum