Javascript error in IE7 and IE8 when using Ajax to get Editor

  •  01-29-2013, 9:51 AM

    Javascript error in IE7 and IE8 when using Ajax to get Editor

    I have an C# ASP.net page that adds the editor programmatically:

     

    protected void Page_Load(object sender, EventArgs e)

    {

          RTE.Editor ed = new RTE.Editor();

          ed.ID = "myEditor";

          Page.Controls.Add(ed);

    }

     

    This works fine in IE7 and IE8 when the page is called directly in the browser.

     

    If I try to Ajax the page, however, I get a Javascript error and the editor does not load:

     

    <html>

    <head>

    <title></title>

    <script type="text/javascript" src="/Assets/jquery/jquery.min.js"></script>

    <script type="text/javascript">

    $.post("getform.aspx",

          function (data) {  $('#pnl').html(data); });

    </script>

    </head>

    <body>

    <div id="pnl"></div>

    </body>

    </html>

     

    Error details:

     

    Line: 4

    Error: Unexpected call to method or property access.

     

    The debugger identifies this as a chunk of eval code.

    This is line 4:

     

    if(location.href.indexOf("://127.0.0.1")!=-1||location.href.indexOf("rtenocache")!=-1)

     

    Attempting to use the implicit "location" object is the issue.

    It is possible to access the "location" object explicitly in the debugger eg "window.location".

     

    This is a big problem for us, as most of our client-base use IE7.

     

    There is no bug in IE9, the editor loads successfully.

    Thanks


    Daniel Barratt

View Complete Thread