Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
689 views
in Technique[技术] by (71.8m points)

javascript - is there a cross-browser alternative to the xhr.overrideMimeType() function?

I don't have access to the server and I need that the whole AJAX transaction to happen using the ISO-8859-1 charset. I'm using the jQuery.load() function together with the following jQuery method:

jQuery.ajaxSetup({'beforeSend' : function(xhr) {xhr.overrideMimeType('charset=ISO-8859-15'); }});

even though firefox and chrome are returning the results correctly encoded, IE (all versions) are not. Is there any way to fix it only at the client-side?

p.s. All the content is correctly encoded in ISO-8859-1.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I just had a similar problem but the issue is basically that 'overrideMimeType' is not supported in IE (any version). So basically you need to do something like in the following articles:

jQuery, AJAX and Internet Explorer by Jeremy Hixon or this question here in StackOverflow

Hope this helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...