开发者

Put HTML string in IFRAME in C# codebehind?

开发者 https://www.devze.com 2022-12-22 05:11 出处:网络
In a C# codebehind, i am calling a web service that returns an HTML blob that i need to stick in an IFRAME. I suppose that i can write it to a temporary file and point th开发者_如何学Ce IFRAME src to

In a C# codebehind, i am calling a web service that returns an HTML blob that i need to stick in an IFRAME. I suppose that i can write it to a temporary file and point th开发者_如何学Ce IFRAME src to that, but is there a way to either (a) write the string to the IFRAME directly, (b) point the IFRAME src to the string somehow (maybe with streams), or (c) some other way?

I want to avoid writing this string to a file.


The IFRAME will require a proper web resource - this can be a dynamic page that simply outputs your HTML blob.


if you save the HTML blob to a file, say www.your-site.com/data/file1.html and then change the iframe src with something like:

window.frames["NameOfYourIFrame"].src = 'www.your-site.com/data/file1.html';

it should work just fine.

0

精彩评论

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