This is a migrated thread and some comments may be shown as answers.

document.domain Access Denied in IE 6

11 Answers 246 Views
Editor
This is a migrated thread and some comments may be shown as answers.
bemana
Top achievements
Rank 1
bemana asked on 28 Jan 2009, 11:51 PM
I'm using document.domain in my application so that I can access properties (DOM) of another website using javascript.  Using document.domain has broken the RadEditors that I'm using.  I'm getting Access Denied errors in IE 6.  It works in Firefox.  I can guess why this is happening.  The RadEditor is using an iframe and the source document's document.domain is not set to the same value.  My understanding that IE 6 requires you to explicity set this value in all windows.

var

 

doc=this._textIframe.contentWindow.document;

 


That's where one of the errors occurs in the telerik javascript.  Basically the iframe isn't accessable from the parent window and the editor just doesn't work at all.  

I think this probably a bug in IE 6 as it should inherit the document.domain setting from the parent window, but it doesn't apparently.  You have to explicity set it.  The src of the iframe is:

javascript:'<html></html>


which isn't a phyiscal page where someone could add:
document.domain = "whatever";

I'm using the latest ajax RadEditor.  Any idea how I can solve this?  Thanks,

Randy

11 Answers, 1 is accepted

Sort by
0
bemana
Top achievements
Rank 1
answered on 29 Jan 2009, 12:14 AM
After submitting this post I did a little more seaching around and found an article that explains the problem in more detail:

http://waelchatila.com/2007/10/31/1193851500000.html

Still no solution apparently.
0
Jeff Tucker
Top achievements
Rank 1
answered on 20 Aug 2009, 09:33 PM
We are running into this issue as well.  Has there been any resolution?
0
Lini
Telerik team
answered on 21 Aug 2009, 08:04 AM
Hi ,

Unfortunately, we have not been able to find a workaround for this problem. Setting the document.domain property in the editor IFRAME is not possible, because we cannot access it in the first place (see http://msdn.microsoft.com/en-us/library/ms533028%28VS.85%29.aspx). This is a security issue with IE, and Microsoft is reluctant to change the browser behavior.

All the best,
Lini
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jeff Tucker
Top achievements
Rank 1
answered on 21 Aug 2009, 06:43 PM
I believe the problem is in the way you intialize the iFrames.  As a proof of concept I have done the following:

function ChangeSrc(sender) {  
    var edtr = sender;  
    var source = "javascript:void((function(){document.open();document.domain=\'tld.com\';document.close();})())";  
    if (typeof edtr._contentAreaElement == "undefined" || edtr._contentAreaElement == null) {  
        var elem = document.createElement("iframe");  
        elem.frameBorder = "0";  
        elem.src = source;  
        elem.style.width = "100%";  
        elem.style.margin = "0px";  
        elem.style.padding = "0px";  
        elem.setAttribute("id", edtr.get_id() + "_contentIframe");  
        edtr._contentAreaElement = elem;  
    } else {  
        //Permission denied  
        try { alert(edtr._contentAreaElement.contentWindow.document.domain); } catch (e) { }  
        edtr._contentAreaElement.src = source;  
        //Permission granted  
        try { alert(edtr._contentAreaElement.contentWindow.document.domain); } catch (e) { }  
    }  
}  
 
function RadEditor_OnClientInit(sender) {  
    ChangeSrc(sender);  
}  
 
function RadEditor_OnClientLoad(sender) {  
    ChangeSrc(sender);  

There are probably several ways of initializing the iframe with the document.domain specified.  The technique above I found in the FCKEditor source code, so I am not sure what the ramifications of that are. 

Now even though the code above does work to set the document.domain and does give the parent window access, the editor still doesn't work in IE.  I assume this is because of other dependencies of which I am unaware.

Suggestions?

0
Lini
Telerik team
answered on 25 Aug 2009, 12:55 PM
Hi,

Thank you for sharing this code. We will try to integrate it again in the editor and see if the document.domain scenario can be fixed. I think that the changes will be more than just setting the src of the content iframe. The editor uses several iframes and the code needs to be added for all of them. Also, we sometimes rewrite the content of some frames (e.g. when the editor content is set) so we need to handle that as well. Finally, the contentWindow.document object of the iframe is not available immediately after adding the iframe to the DOM. We will do our best to fix this scenario before the next official RadControls release.

Sincerely yours,
Lini
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ryan
Top achievements
Rank 1
answered on 19 May 2010, 03:51 AM
Has a fix been implemented for this yet? We are running an application with document.domains explicitly set in order to facilitate cross server scripting on the same domain. The RadEditor is throwing "access denied" errors when building the iframes.
0
Rumen
Telerik team
answered on 21 May 2010, 09:59 AM
Hi Ryan,

The problem is still not fixed because the content area of RadEditor is an editor IFRAME element.

We are currently working on a new content area mode based on an editable DIV which will allow us to fix the problem. The new DIV editable mode is planned for Q2 2010 release of the control, which is scheduled for the beginning of July.

Greetings,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rodolfo
Top achievements
Rank 1
answered on 25 Sep 2010, 11:29 PM
Was this released in July? I believe I'm hitting this issue now, using v5.8.1
0
Rumen
Telerik team
answered on 27 Sep 2010, 07:53 AM
Hello Rodolfo,

RadEditor for MOSS v5.8.1 offers the ability to render its content area as an editable DIV element. All you need to do is to set the ContentAreaMode property as shown below:

<property name="ContentAreaMode">Div</property>

in the ConfigFile.xml / ListConfigFile.xml file.

Kind regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Rodolfo
Top achievements
Rank 1
answered on 27 Sep 2010, 03:46 PM
Thanks Rumen,

Very quick response, that seemed to be the answer, but unfortunately my developer reported back:

...when we try this we can't invoke the Link Manager because we get:

 

Webpage error details

 

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; .NET4.0C; .NET4.0E; InfoPath.3; Zune 4.0)

Timestamp: Mon, 27 Sep 2010 12:31:28 UTC

 

 

Message: Object required

Line: 86

Char: 2

Code: 0

Do you have any idea why this would be?

Thanks for your response.

0
Rumen
Telerik team
answered on 30 Sep 2010, 10:59 AM
Hello Rodolfo,

The problem is due to that the LinkManager dialog use an IFRAME element for its content area.

My suggestion is to test the MOSSLinkManager and InsertLink and if they work as expected in document.domain scenario to use them instead of the iframe based LinkManager dialog.

The Insert Link dialog is a light version of Hyperlink Manager. When enabled, its content is rendered on page load and as a result the content is immediately loaded when the diaolg is shown without any delay. In order to have it decorated you should put a RadFormDecorator on the main page.

You can see how to add / remove the toolbar buttons in this article: Add/Remove tools from the toolbar.

Sincerely yours,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Editor
Asked by
bemana
Top achievements
Rank 1
Answers by
bemana
Top achievements
Rank 1
Jeff Tucker
Top achievements
Rank 1
Lini
Telerik team
Ryan
Top achievements
Rank 1
Rumen
Telerik team
Rodolfo
Top achievements
Rank 1
Share this question
or