Hi !
Here is a code (using jquery) i use to download a html file from which I extract a table and its content.
var url = $('#url').val(); // url to access
if ($.browser.msie && $.browser.version.substr(0,1)<7) {
var frame = $('<iframe/>').css('display', 'none').attr('src', url );
frame.appendTo('body')
.load(function() {
var data = frame.contents()[0].firstChild.innerHTML;
frame.remove; // kill the frame
extractReport(data); // extract the data table
}); // load
}
else {
$.ajaxSetup({
'beforeSend' : function(xhr) {
xhr.overrideMimeType('text/html; charset=ISO-8859-1');
}
}); // ajaxSetup
$.ajax(
{
async:false,
url:url,
error : function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus );
},
success:
function(data, textStatus, XMLHttpRequest) {
extractReport(data);
}
}); // ajax
} //else
My problem is that when I use a xmlhttprequest active-X object in IE6, the responseText contains garbage for French characters. I managed to bypass this with an iframe (ie6 do not support overrideMimeType which I use for Firefox). But now the javascript contained in the html frame is executed. Is there a way in IE6 to download my html file in the correct charset without executing the javascript ?
Note: I am not authorized to change the Apache config to force a ISO-8859-1 charset.
My idea : Could the html be download as a plain text with an activeX ? The only one I know is ActiveXObject("Msxml2.XMLHTTP.6.0") and it fails.