Cef 重写alert与confirm弹窗
在使用form内嵌cef浏览本地页面的时候,如果出现alert弹窗,会在标题栏显示页面所在目录。所以想起来重写alert的样式,通过MessageBox进行提示,或者自己写一个弹窗。

以下代码基于 3.2623.1401.gb90a3be 也就是最后一个兼容xp的版本
procedure Tfrm.Chromium1Jsdialog(Sender: TObject;
const browser: ICefBrowser; const originUrl, acceptLang: ustring;
dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring;
callback: ICefJsDialogCallback; out suppressMessage, Result: Boolean);
var
m: ustring;
begin
inherited; case dialogType of
JSDIALOGTYPE_ALERT:
begin
GLB.ShowMsgBoxWarning(messageText, defaultPromptText);
suppressMessage:=True;
Result:=False;
end;
JSDIALOGTYPE_CONFIRM:
begin
callback.Cont(GLB.ShowMsgBoxQuery(messageText, defaultPromptText)=mrYes, m);
suppressMessage:=False;
Result:=True;
end;
// JSDIALOGTYPE_PROMPT: //输入框;
end;
end;
Cef 重写alert与confirm弹窗的更多相关文章
- [Winform]Cefsharp重写alert与confirm弹窗
摘要 在使用winform内嵌cefsharp浏览本地页面的时候,如果出现alert弹窗,会在标题栏显示页面所在目录.所以想起来重写alert的样式,通过winform的MessageBox进行提示. ...
- JS重写alert,保证弹窗错误的友好性
// ------------------------------------------------------------- // 重写alert,保证弹窗错误的友好性 var j_oldAler ...
- phantomjs处理alert、confirm弹窗
一:phantomjs处理alert弹窗 脚本实现功能为:点击click me按钮弹出弹窗消息为cheese,点击确定按钮,弹窗关闭 脚本代码为:注意的是phantomjs处理alert弹窗需要将ph ...
- 重写Alert和confirm方法去除地址显示
//重写alert方法,去掉地址显示window.alert = function(name){var iframe = document.createElement("IFRAME&quo ...
- js重写alert()弹窗
//重写alertwindow.alert = function(str){ var alertFram = document.getElementById('alertFram'); var shi ...
- java+selenium自动化遇到confirm弹窗,出现NoAlertPresentException: no alert open
//操作js的confirm弹窗,bool控制是否点击确定,true为点击确定,false为点击取消 public static void OperaterJSOfConfirm(WebDriver ...
- jQuery插件css3动画模拟confirm弹窗
相比浏览器自带的alert.confirm,能力所及,我更喜欢所有的东西都是自定义:首先在head标签(当然喜欢其他地方自己看着办)内引入插件样式表和js.<link rel="sty ...
- 重写alert方法,去掉地址显示
//重写alert方法,去掉地址显示window.alert = function(name){ var iframe = document.createElement("IFRAME&qu ...
- selenium+Python(alert 、confirm 、prompt 的处理)
alert\confirm\prompt 弹出框操作主要方法有: text 返回 alert/confirm/prompt 中的文字信息 accept 点击确认按钮 dismiss 点击取消按钮, ...
随机推荐
- nginx 配置总结
可以选择在http{ }中设置:client_max_body_size 20m; 也可以选择在server{ }中设置:client_max_body_size 20m; 还可以选择在locatio ...
- 多线程04-ThreadPriority
; i < ; i++) { Thread.Sleep(); Console.WriteLine( ...
- python基础循环语句练习
1.使用while循环输入 1 2 3 4 5 6 8 9 10 n = 1 while n < 11: if n == 7: pass else: print(n) n = n + 1 ...
- SpringMvc+Mybatis开发调用存储过程
<mapper namespace="com.jkw100.ssm.mapper.CustomerMapperCustom" > <!-- statementTy ...
- 使用Vue开发微信小程序:mpvue框架
使用Vue开发微信小程序:mpvue框架:https://www.jianshu.com/p/8f779950bfd9
- 基本数据类型间的运算(不包括boolean)
一 基本数据类型的间的运算 (不包括boolean) 1.自动类型提升 : 小容量的变量和大容量的变量做运算结果用大容量的变量的类型来接收. byte , short , char -> in ...
- AtCoder Beginner Contest 133 -D — Rain Flows into Dams
(https://atcoder.jp/contests/abc133/tasks/abc133_d) 思路:每座山为2Xi,每个坝为Ai.已知Ai,求出2Xi. 根据已知的X1,则可分别求出X2-n ...
- vue 跳转页面返回时tab状态有误的解决办法
一.前言 最近在做新vue项目的时候遇到了一个问题,就是tab间的切换没有问题,当跳转到其他页面时,且这个页面并非子路由,再用浏览器的返回按钮返回首页时,tab的active始终指向默认的第一个选项. ...
- VirtualStringTree常用类和属性
重要的类:TBaseVirtualTree = class(TCustomControl)TCustomVirtualStringTree = class(TBaseVirtualTree)TVirt ...
- ASP.NET @URL帮助类
原文: https://www.cnblogs.com/bobo-show/p/5746389.html https://www.cnblogs.com/zhuji/p/7698057.html ...