将 html 框架集代码从内存加载到 Java SWT 浏览器
我有一个用 SWT 编写的简单 html 编辑器,它是浏览器控件。我想知道是否有一种方法可以从内存加载html框架页面的代码,而不将html文件保存在硬盘上?
I have a simple html editor written with SWT and it's Browser control. I would like to know if there is a way to load the code for html frame pages from memory, without saving the html file on the hdd?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在寻找的代码是 SWT 浏览器小部件片段之一。请参阅 从内存中渲染 HTML。
还有一些其他片段可能对您来说很方便。检查 SWT 浏览器的小部件片段 。
The code which are you looking for is one of the SWT Browser widget snippets. See render HTML from memory.
There are few others snippets which may became handy for you.. Check SWT Browser's widget snippets.
在内存中的 HTML 中添加一行即可解决问题。
例如,假设您的文件
page1.html
等位于本地计算机的C:/myHTML
中,那么您需要将其添加到内存中的 HTML 字符串中,如下所示,这对我在 Win 7 上有效。
Add one line in your in memory HTML will do the trick.
For example, assume your files
page1.html
etc. locate in your local computer atC:/myHTML
, then you need add this to your in memory HTML string as below,This works for me on Win 7.