简体   繁体   English

WebBrowser控件,无需从文件中加载文档

[英]WebBrowser control without loading a document from file

I have a scenario where i would like to show some object's description (which is currently stored in XML format) on a WebBrowser control. 我有一种情况,我想在WebBrowser控件上显示一些对象的描述(当前以XML格式存储)。

The object is already serialized into memory, and i would like to avoid reading it again from file for display purposes on the WebBrowser control. 该对象已被序列化到内存中,并且我想避免再次从文件中读取该对象以在WebBrowser控件上显示。

The reason for going this way is we would like to use XSL to format this object's presentation the way we like (and to have flexibility in doing so). 这样做的原因是我们希望使用XSL以我们喜欢的方式格式化该对象的表示形式(并在这样做时具有灵活性)。

To do this, i would like to (somehow) inject the object's xml as string into the WebBrowser. 为此,我想(以某种方式)将对象的xml作为字符串注入WebBrowser中。

Can this be achieved? 能做到吗? is there a better option for handling this scenario? 有没有更好的选择来处理这种情况?

You could try handing it a data URL containing an encoded version of your XML. 您可以尝试将包含XML编码版本的数据URL传递给它。 Not sure if this will work, or what the limitations on size are. 不知道这是否行得通,或者不确定大小限制。

Make a quick browser extension to communicate with your application? 进行快速浏览器扩展以与您的应用程序通信? The downside would be the extension will have to be installed as well and you'd have to make a separate extension for all major browsers. 不利的一面是该扩展程序也必须安装,并且您必须为所有主要浏览器制作一个单独的扩展程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM