Thanks for your reply ;
OK , I'll check t out...
Thanks for your reply ;
JustinJustin wrote: Sun Dec 17, 2023 10:02 am Doesn't the NavigationStarting event do what you want?
https://learn.microsoft.com/en-us/micro ... navigating
Sorry to be so stupid, but I can't find a 'NavigationCallback()' .
Code: Select all
Procedure core_HistoryChanged(this.IWV2EventHandler, sender.ICoreWebView2, args.IUnknown)
Protected.BROWSER *browser
Debug "1 Procedure core_HistoryChanged " + urlGlobal
Debug "args.IUnknown = " + args.IUnknown
Debug "sender.ICoreWebView2 = " + sender.ICoreWebView2
Debug "this.IWV2EventHandler = " + this.IWV2EventHandler
this\LockMutex()
*browser = this\GetContext()
;Nav buttons
If *browser = tab_GetCurrentBrowser()
toolBar_UpdateNavButtons(*browser)
EndIf
this\UnlockMutex()
Debug "2 Procedure core_HistoryChanged " + urlGlobal
EndProcedure
Code: Select all
Procedure toolBar_UpdateNavButtons(*browser.BROWSER)
Protected.l canGoBack, canGoForward
Debug "1 Procedure toolBar_UpdateNavButtons " + urlGlobal
If *browser And *browser\core
*browser\core\get_CanGoBack(@canGoBack)
gadget_Enable(app\btnGoBack, canGoBack)
btn_Draw(app\btnGoBack)
*browser\core\get_CanGoForward(@canGoForward)
gadget_Enable(app\btnGoForward, canGoForward)
btn_Draw(app\btnGoForward)
EndIf
Debug "2 Procedure toolBar_UpdateNavButtons " + urlGlobal
EndProcedure
Code: Select all
Procedure core_SourceChanged(this.IWV2EventHandler, sender.ICoreWebView2, *args.ICoreWebView2SourceChangedEventArgs)
Protected.BROWSER *browser
Protected.i uri
Protected.s suri
this\LockMutex()
sender\get_Source(@uri)
If uri
suri = PeekS(uri)
str_FreeCoMemString(uri)
If GetURLPart(suri, #PB_URL_Site) = "www.youtube.com" And FindString(suri, "watch?")
sender\ExecuteScript(~"location.replace(\"http://xxxxxxx.xxx/NotApproved.html\")", 0)
EndIf
url_Edit_SetText(app\url, suri)
EndIf
this\UnlockMutex()
EndProcedure
Code: Select all
*browser\core\Navigate("http://kidsafebrowser.us/Warning-UnSafe-Site.html")
Code: Select all
Procedure IfThisLinkOk(Passed_suri$) ; vm
Debug "1 LINK Procedure IfThisLinkOk = " + Passed_suri$ ; vm"
ThisLinkItemOk = #False
ResetList(ThisLinkList())
While NextElement(ThisLinkList())
CurrentElementContent$ = ThisLinkList()
; Debug "IfThisLinkOk CurrentElementContent$" + CurrentElementContent$
Position = FindString(Passed_suri$, CurrentElementContent$ , 0 )
If Position > 0
Debug "ThisLinkItemOk = #True " + Passed_suri$
ThisLinkItemOk = #True
EndIf ; Greater than 0 == Yes its a Hit
Wend
If ThisLinkItemOk = #False
; GO TO: https://kidsafebrowser.us/Warning-UnSafe-Site.html
*browser\core\Navigate("http://kidsafebrowser.us/Warning-UnSafe-Site.html") ;
EndIf
EndProcedure ; IfThisLinkOk()
Code: Select all
With 'EnableExplicit' , variables have to be declared: *browser.