开发者

HTML mht doesn't render well on ajax call?

开发者 https://www.devze.com 2023-01-01 15:05 出处:网络
I have a file (viewdoc) which writes a .mht file to the screen. In my application I have two main divs: one for the menu (= treeview) and one div to 开发者_Go百科display the .mht file (#documentConten

I have a file (viewdoc) which writes a .mht file to the screen. In my application I have two main divs: one for the menu (= treeview) and one div to 开发者_Go百科display the .mht file (#documentContent).

My menu calls a javascript function which performs an ajax request to viewdoc and put the output of viewdoc in my content div (#documentContent):

function loadDocument(id, doc) {
    $("#documentContent").load('viewdoc.aspx?id=' + id + '&doc=' + doc + '');
}

The problem is, in the #documentContent div, the content isn't parsed as .mht. But when I call viewdoc directly from the browser, the content is displayed correctly.

In viewdoc.aspx I set the content type:

Response.ContentType = "message/rfc822";
Response.ContentEncoding = Encoding.UTF8;

Isn't it possible to display two content types on one 1 page? Or what is the problem here?


No, you can't set 2 contenttypes for 1 page.

And your code will never be parsed as mht in some div. It is html :) All you can do - use iframe or use other format of viewdoc.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消