user666197
user666197

Reputation: 227

Chrome on IOS 8+ crweb.js and __gCRweb issue

I am just trying to debug an issue which is very specific with Chrome on IOS.
For some reason, when I load a page, a javascript file gets loaded which looks like

{guid}_crweb.js  
(eg something like/ FE4123F-DD9C-4D21-4D21-DADAFDWER432_crweb.js) 

Inside this javascript file I can see a reference to _gCrWeb, still not sure what it is doing.

The issue I am having is the script tag is is being added to the head of my json string in my ajax call. But only some.

Does anyone have any assistance about what this crweb is? Any any suggestions of how to stop chrome adding it to the ajax calls?

Thanks

Upvotes: 0

Views: 858

Answers (3)

smorgan
smorgan

Reputation: 21579

This is a known bug, which should be fixed in versions 41 and beyond; the intent is for the script to be added to actual pages, not XHR responses, but there were false-positives.

As noted in another answer, ensuring that your responses aren't using an HTML MIME type will prevent the spurious injection.

If you still see false positives with 41+, please file a bug.

Upvotes: 0

vinboxx
vinboxx

Reputation: 685

Make sure that response header should be

Content-Type:application/json; 

not

Content-Type:text/html; charset=UTF-8

Upvotes: 1

Marius Po
Marius Po

Reputation: 11

Today i found the same problem: after ajax call i'm getting response with script in front:

<script src="{guid}_crweb.js" charset="utf-8"></script>{my_json_response}

Not sure why chrome adding this script, but my workaround for now is split response (remove script part from response):

msg = fix_chrome_issue(msg);

function fix_chrome_issue(msg) {
    var parts = msg.split("</script>{");
    if(parts[1]) {
        msg = '{' + parts[1];
    }

    return msg;
}

Upvotes: 1

Related Questions