@@ -395,6 +395,19 @@ bool QCefBrowserClient::OnContextMenuCommand(
395
395
return false ;
396
396
}
397
397
398
+ void QCefBrowserClient::OnLoadStart (CefRefPtr<CefBrowser>,
399
+ CefRefPtr<CefFrame> frame, TransitionType)
400
+ {
401
+ if (!frame->IsMain ())
402
+ return ;
403
+
404
+ std::string script = " window.close = () => " ;
405
+ script += " console.log(" ;
406
+ script += " 'OBS browser docks cannot be closed using JavaScript.'" ;
407
+ script += " );" ;
408
+ frame->ExecuteJavaScript (script, " " , 0 );
409
+ }
410
+
398
411
void QCefBrowserClient::OnLoadEnd (CefRefPtr<CefBrowser>,
399
412
CefRefPtr<CefFrame> frame, int )
400
413
{
@@ -405,12 +418,6 @@ void QCefBrowserClient::OnLoadEnd(CefRefPtr<CefBrowser>,
405
418
frame->ExecuteJavaScript (widget->script , CefString (), 0 );
406
419
else if (!script.empty ())
407
420
frame->ExecuteJavaScript (script, CefString (), 0 );
408
-
409
- std::string script2 = " window.close = () => " ;
410
- script2 += " console.log(" ;
411
- script2 += " 'OBS browser docks cannot be closed using JavaScript.'" ;
412
- script2 += " );" ;
413
- frame->ExecuteJavaScript (script2, " " , 0 );
414
421
}
415
422
416
423
bool QCefBrowserClient::OnJSDialog (CefRefPtr<CefBrowser>, const CefString &,
0 commit comments