window.execScript fails in ie8

2019-08-27 11:04发布

I work in ruby on rails (3.2.11) with jquery 1.9.1... in my app I developed a chat in javascript.

With IE9 all is ok, in IE8 when calling

function refresh_contacts() {       
 url = $('#refresh_contacts_url').val()
 $.ajax(url)
}

I get the error in the subject... I tried to isolate the problem and it seems it's the ajax call (just the call, even if there is no code on the called function, so I think it's the call itself who raise the problem)...

The code which raise the error (as indicated by the IE debugger) is in jquery (around line 603 non minified, version 1.9.1):

globalEval: function( data ) {
    if ( data && jQuery.trim( data ) ) {
        // We use execScript on Internet Explorer
        // We use an anonymous function so that context is window
        // rather than jQuery in Firefox
        ( window.execScript || function( data ) {
            window[ "eval" ].call( window, data );
        } )( data );
    }
},

I tried several workarounds I found on the net like using async: false and cheating with the XMLHttpRequest, with no luck...

Tnx, Fabio

0条回答
登录 后发表回答