I have created a traditional file upload using form and iframe. My html:
<form id="theuploadform">
<div class="form-group">
<input id="importFile" name="file" size="50" type="file" />
</div>
</form>
The javascript:
var iframe = $('<frame name="postiframe" id="postiframe" style="display: none"></frame>');
$("body").append(iframe);
var form = $('#theuploadform');
form.attr("action", "/uploadhandler.ashx");
form.attr("method", "post");
form.attr("encoding", "multipart/form-data");
form.attr("enctype", "multipart/form-data");
form.attr("target", "postiframe");
form.attr("file", $('#userfile').val());
form.submit();
Now it will post to UploadHandler.ashx
that will write the contents of the file to the iframe:
context.Response.ContentType = "text/plain";
context.Response.Write(new StreamReader(file.InputStream).ReadToEnd());
My problem here is that the iframe content is being rendered different on ie9 and ie11.
IE11:
<iframe>
<!DOCTYPE html>
<body>
<pre>
// xml content here //
</pre>
IE9:
<iframe>
<Nodename xmlns:xsd="http://www.w3.org/2001/XMLSchema">
Any thoughts to make the iframe same as on IE11?
EDIT
I have the following code on my _Layout.cshtml
:
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />