gpt4 book ai didi

delphi网络浏览器: how to prevent or hide that javascript error?

转载 作者:行者123 更新时间:2023-12-03 15:00:56 25 4
gpt4 key购买 nike

我正在运行 TEmbeddedwb,但在该 TEmbeddedwb 上导航时出现了 javascript 超时错误。

(我在 Internet Explorer 中运行时没有出现此错误!)

enter image description here

浏览器询问我是否要停止脚本的执行。

我将 TEmbeddedwb 属性添加到

沉默=真

dialogoBox.disableAll = true

但我仍然弹出这个弹出窗口!

1) 为什么我在 Internet Explorer 上导航时没有错误却出现此错误(在 2 台电脑上测试)

2) 如何禁用/隐藏此弹出窗口?

问候

    unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw_EWB, EwbCore, EmbeddedWB;

type
TForm1 = class(TForm)
iemain: TEmbeddedWB;
procedure iemainScriptError(Sender: TObject; ErrorLine, ErrorCharacter,
ErrorCode, ErrorMessage, ErrorUrl: String;
var ScriptErrorAction: TScriptErrorAction);
procedure FormCreate(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.iemainScriptError(Sender: TObject; ErrorLine,
ErrorCharacter, ErrorCode, ErrorMessage, ErrorUrl: String;
var ScriptErrorAction: TScriptErrorAction);
begin
MessageDlg('hello', mtWarning, [mbOK], 0);
if ErrorCode='123' then ScriptErrorAction := eaContinue;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
iemain.Navigate('http://www.expedia.fr/Hotels');
end;

end.

最佳答案

如何处理 TEmbeddedWB 中的 JavaScript 错误?

OnScriptError 事件编写一个处理程序,并在 ScriptErrorAction 输出参数中返回可用的 TScriptErrorAction 值之一。要忽略脚本错误并继续使用,例如:

procedure TForm1.EmbeddedWB1ScriptError(Sender: TObject; ErrorLine,
ErrorCharacter, ErrorCode, ErrorMessage, ErrorUrl: string;
var ScriptErrorAction: TScriptErrorAction);
begin
if ErrorCode = 123 then
ScriptErrorAction := eaContinue;
end;

关于delphi网络浏览器: how to prevent or hide that javascript error?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15276255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com