Can't load Google Cloud Endpoints on Internet Explorer 10

后端 未结 3 1545
独厮守ぢ
独厮守ぢ 2021-02-13 15:49

I\'m working on a web site that is using the Google JavaScript Client Library to load some APIs that are exposed via Google Cloud Endpoints. The endpoints were developed in Pyth

相关标签:
3条回答
  • 2021-02-13 16:29

    I have had similar issues with loading Google APIs for the Google Earth plugin in IE 10 and 11. The only resolution we have found (Other than Google fixing this) is to force IE 10 to run in IE 9 mode. Every version of IE includes the rendering engines from the previous major versions. You can test this manualy by going into the developer tools in IE and set which IE rendering engine you want to use.

    You can force IE to render in a specific mode by adding this meta tag in your html file:

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=9"/>
    

    It HAS to be the first meta tag in the HTML file, or it will be ignored by IE. This meta tag will be ignored by other browsers. This will however make your entire page render with the IE 9 engine so you do lose cpabilities present in IE 10 and 11. If you need IE 10 functionality this solution will not work for you. If IE 9 compatibility is part of your requirements, this may be a work around for this problem

    This link has more info on the IE compatibility modes

    0 讨论(0)
  • 2021-02-13 16:31

    Hope it can help :


    var executeRequest = function(path, data, callback, method){
        var url = ‘YOUR_API_LINK' + path;
        $.ajax({
            url: url,
            type: method,
            dataType: 'json',
            data: data?data:null,
            success: function(data, status, xhr) {
            },
            error: function(xhr, status, error) {
            },
            complete: function(xhr, status) {
                var data = null;
                console.log('Request ' + url + ' completed');
                if (xhr.responseText && xhr.responseText.length > 0) {
                    data = $.parseJSON(xhr.responseText);
                }
                if (callback)
                    callback(data);
            }
        });
    };
    
    ---------------
    
    Simple call example of this function made in the same file :
    
    ---------------
    
    var simpleGetUser = function(userKey, callback){
        this.executeRequest(
        '/user/v1/user/' + userKey,
        {/* If you got any parameters, put them here */},
        function (res) {
            if (callback)
                callback(res);
        }, 'GET');
    };
    

    Good luck !

    0 讨论(0)
  • 2021-02-13 16:33

    It must be an IE10 JavaScript problem. Agreed the null must be coming from document.getElementById('root') as you pointed out. Your page would not normally contain such an element, and the name is not distinctive. I suspect that the 'root' element is meant to be created by another piece of JavaScript hailing from Google, and it is that other JavaScript code that has (silently) failed. Harness your considerable Debug-Fu to look in that direction. Sorry, I would like to help more, but that would breach Microsoft's Terms and Conditions (the ones about if I don't pay them for each instance I am forbidden to run their software).

    EDIT: Since proxy.html contains both the offending JavaScript code and the 'root' element, Google could correct it by changing the order of the elements. Sensibly, many authors recommend locating the JavaScript just before the bottom of the html body. If you're in a position to reference your own copy of proxy.html, you could try the fix yourself before nagging Google about it.

    0 讨论(0)
提交回复
热议问题