手动在TWebBrowser中编写HTML [英] Manually Writing the HTML in TWebBrowser

查看:173
本文介绍了手动在TWebBrowser中编写HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:看看Jorn的方法。

我使用的策略是: http://cc.embarcadero.com/Item/23992 在TWebBrowser中获取我的HTML,但当页面加载时,我收到一堆JavaScript错误。如果我点击了足够的时间,我可以看到一个没有格式的页面,我猜这个页面什么也没有。



我的理论是,因为HTML中的链接相对而言,浏览器无法加载任何它。我将URL转换为about:blank到浏览功能,传递服务器主页,希望有些内部机制能够生成完整路径,但没有运气。



任何一个成功地可以手动将HTML写入TWebBrowser。

解决方案

由于HTML不是来自实际网址,您需要在HTML本身中包含一个< base href = ...> 标签,以便相对链接可以正确解析。 / p>

EDIT: Look at Jorn's approach.
I am using the strategy suggested here: http://cc.embarcadero.com/Item/23992 to get my HTML in the TWebBrowser, but I get a bunch of JavaScript errors when the page loads. If I click yes enough times I can see a page with no formatting and I'm guessing the page does nothing.

My theory is that because the links in the HTML are relative, the browser can't load any of it. I have switch from passing the URL, 'about:blank' to the navigate function, to passing the servers home page - in the hopes that some internal mechanism will be able to generate full paths, but no luck.

Any one successfully been able to manually write HTML to the TWebBrowser.

解决方案

Since the HTML is not coming from a live URL, you need to include a <base href=...> tag in the HTML itself so relative links can be resolved correctly.

这篇关于手动在TWebBrowser中编写HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆