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

Problems with CSS from another domain

4 Answers 453 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Desa Julian
Top achievements
Rank 1
Desa Julian asked on 24 Jul 2009, 01:34 PM
Hi there,

I'm having problems with opening the hyperlink manager when the external CSS file linked to in the header points to a different domain.  Basically, if the external CSS is not  linked from the same domain, the hyperlink manager is totally unresponsive.

Specifically, here's my code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="radEditor_test.aspx.cs" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title></title
     
    <link rel="stylesheet" type="text/css" href="http://a_different_domain.com/styles.css" /> 
     
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
    <asp:ScriptManager ID="ScriptManager" runat="server" /> 
    <telerik:RadEditor ID="radEditor" runat="server" Width="100%" EnableEmbeddedSkins="true" 
        ToolsFile="~/Editor/ToolsFile.xml" EditModes="Design" NewLineBr="false" 
        StripFormattingOnPaste="MSWordNoFonts, Css, Font, Span" ExternalDialogsPath="~/Editor" /> 
    </div> 
    </form> 
</body> 
</html> 

If I copy the stylesheet to a space on the same domain as the page, then the hyperlink manager works as expected.  However, this is not an option given the way our system is set up.

Is there anyway I can get the hyperlink manager to work when the CSS files is linked from a different domain?

Thanks,

DJ

4 Answers, 1 is accepted

Sort by
0
Desa Julian
Top achievements
Rank 1
answered on 24 Jul 2009, 02:56 PM
Here's a little more information.

When debugging in firebug I get the following error when clicking the hyperlink manager:

Security error" code: "1000 
[Break on this error] var _8d8=(_8d5.rules)?_8d5.rules:_8d5.cssRules;\n 

0
Rumen
Telerik team
answered on 27 Jul 2009, 01:35 PM
Hi Desa,

This scenario is not supported because due to potential vulnerabilities the browser security does not allow the javascript to read the styles from the different domain. You should always load styles from the same domain or remove the css classes dropdown from the link manager.

Kind regards,
Rumen
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
Desa Julian
Top achievements
Rank 1
answered on 27 Jul 2009, 02:35 PM
Hi there,

thanks for the reply.

I tried removing all references to the applyClassDropDown tool and even deleted all JS functions that deal with CSS in LinkManager.ascx but it still fails on the same line. of code in firefox.

Alternatively, is there a way that I can specify exactly which CSS file the dialog box and radEditor should use and prevent it from trying to access the css linked to on the page where the editor is embedded?  I tried setting DialogsCssFile but it still fails in the same way.
0
Rumen
Telerik team
answered on 29 Jul 2009, 12:19 PM
Hi Desa,

You can choose between the following two approached:

1) Hide the CssClasses dropdown in the LinkManager. You can do that by registering the external dialog files for RadEditor, opening the LinkManager.ascx file and hiding the LinkCssClass tr element, e.g.

<tr style="display:none;">
    <td class="reLabelCell">
        <label for="LinkCssClass" class="reDialogLabel">
            <span>
                <script type="text/javascript">document.write(localization["CssClass"]);</script>
            </span>
        </label>
    </td>
    <td class="reControlCell">
        <tools:ApplyClassDropDown id="LinkCssClass" runat="server" />
    </td>
</tr>

Save the file.

2) The second approach is to set the CssFiles property to point to your own external css file, e.g.

<telerik:RadEditor runat="server" ID="RadEditor1" runat="server">
    <CssFiles>
        <telerik:EditorCssFile Value="~/custom.css" />
    </CssFiles>

</telerik:RadEditor>

Therefore the editor will read only the classes placed in this css file and will not pick up the styles from the page.

Kind regards,
Rumen
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.
Tags
Editor
Asked by
Desa Julian
Top achievements
Rank 1
Answers by
Desa Julian
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or