问题标签 [twebbrowser]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1269 浏览

delphi - 如何让 TWebBrowser 忽略其他控件的加速字符?

我在启用了 designMode 的表单上放置了一个 TWebBrowser。
在浏览器下方,我有一个关闭按钮,标题设置为“关闭&e”。
当我在 WebBrowser 中编辑文档内容并按下 E 键时,会调用关闭按钮。
它似乎将 TWebBrowser 视为其他不处理键和/或不接受字符的控件(例如 TButton)。

我该如何解决这个问题?

提前致谢。

0 投票
1 回答
1707 浏览

delphi - 在编辑模式下检测 TWebBrowser 中的光标位置

我得到这样的选择范围:

TWebBrowser 正在编辑中。我需要获取光标的位置。我怎样才能得到它?

0 投票
4 回答
3045 浏览

delphi - 如何禁用 WebBrowser 组件加载图像?

只加载没有图像的html?

0 投票
2 回答
2510 浏览

delphi - 如何设置与 HTML 位置不同的 Delphi WebBrowser Base 目录

我有一个创建 HTML 文件的 Delphi 程序。稍后,当按下按钮时,会创建一个 TWebBrowser 并且 WebBrowser.Navigate 会导致显示 html 页面。

无论如何设置WebBrowser“默认目录”所以它总是Delphi可执行文件的位置而不是HTML文件?

我不想将 HTML 中的 Base 值设置为硬编码值,因为当从另一个 Delphi exe 运行 HTML 时,找不到它们。

例如:

如果 exe 从 D:\data\delphi\pgm.exe 运行,则基本位置 D:\data\delphi\ 和 jpg 位于 D:\data\delphi\jpgs\

但如果 exe 从以下位置运行:C:\stuff\pgm.exe 我希望基本位置为 C:\stuff\,而 jpgs 位于 C:\stuff\jpgs\

所以我不能在 HTML 中用基本位置写一行,因为当它从另一个 exe 运行时,它会指向该 exe 的错误位置。

因此,我需要在创建网络浏览器时和阅读 HTML 之前设置基本位置,或者我需要一种方法将我可以设置基本位置的位置传递给网络浏览器。

很抱歉这么啰嗦,但我不知道如何看到我需要的东西。

0 投票
1 回答
9914 浏览

delphi - 如何禁用“TWebbrowser”上的 javascript 错误?

我正在浏览的某些网页中弹出 javascript 错误。

有谁知道如何使用 TWebbrowser 禁止在 Delphi 应用程序中显示 javascript 错误框?或任何其他消息框?

0 投票
3 回答
7560 浏览

delphi - 在 Delphi 中打开带有帖子的默认浏览器

我知道在 delphi 中,您可以使用以下命令打开默认浏览器:

但我想知道是否有办法在新打开的浏览器窗口上自动发布数据或自动填充登录数据(即使在 firefox、safari 等中)

谢谢

-布拉德

0 投票
1 回答
1669 浏览

javascript - How to send arrow keys to Adobe Flash Player inside a Delphi TWebBrowser control?

I am using a TWebBrowser control inside a Delphi Pro 6 form (TForm) to view a YouTube video on YouTube's "leanback" interface page. I want to send arrow keys to the Flash Player that is playing the video but I can't seem to get it to work. I've tried using SendKeys but my guess is that I am unable to get the keystroke events to the Flash Player itself. I've tried sending the keys to the TWebBrowser control's window handle but nothing happens, even after setting input focus to it. I tried both the TWebBrowser Handle property and the HWND property, the latter of which is recommended by the Delphi Help documentation to use with Windows API calls. The Handle property as I said results in no apparent action and when I try the HWND property I get an "unspecified error" from the TWebBrowser OLE interface code.

Can anyone think of a way to make this work? Or if not, a way to get the Adobe flash player's window handle via Delphi code or injected Javascript? Or perhaps a way to use Javascript to talk to the Flash Player object and get the arrow keys working?

Thanks.

0 投票
1 回答
3184 浏览

javascript - 在 Delphi 中使用 TWebBrowser 时如何抑制脚本错误警告?

可能重复:
如何禁用“twebbrowser”上的 javascript 错误?

我在 Delphi 6.0 中使用 TWebBrowser 组件来显示 YouTube 网页。有时我会从 TWebBrowser 嵌入的 Internet Explorer 中收到一个脚本错误消息框,抱怨页面上运行的脚本发生错误并提示我“是或否”以禁用页面上任何脚本的进一步执行。

我希望能够禁止所有脚本警告框,因为某些网页在 TWebBrowser 组件中的行为很有趣。有没有办法做到这一点?

提前致谢。

0 投票
2 回答
1269 浏览

delphi - 使用 TWebBrowser 获取发布到网站后返回的 PDF

我正在使用 Delphi 2007。我可以使用 WebBrowser.Navigate 成功地将数据发布到网站,但是之后,当该网站返回 PDF 时,当它出现在浏览器的屏幕上时,我无法弄清楚如何以编程方式获取 PDF . 我可以使用 Document.Body.InnerHTML 看到一些文本和 HTML,但看不到 PDF。有人可以演示如何获取 POST 之后出现的 PDF 吗?

谢谢你!

0 投票
4 回答
11191 浏览

windows - TWebBrowser 是否依赖于 IE 版本?

我正在考虑在项目中使用 Delphi 默认组件托盘中的 TWebBrowser 组件,但我想知道它是否使用安装在客户端计算机上的 IE 版本?

如果是的话:
那么我猜它会分享它的历史、cookies、workoffline 和类似的东西?
我可以以某种方式将它们分开吗?
是否有任何 webbrowser 组件是免费的并且不与客户端上的 Internet Explorer 共享?