Browser widget - is there something similar to browserBeforeNavigate

Matthias Rebbe matthias_livecode_150811 at m-r-d.de
Mon May 6 16:41:05 EDT 2019


Thanks Hermann for the sample script.

Regards,
Matthias



> Am 06.05.2019 um 14:24 schrieb hh via use-livecode <use-livecode at lists.runrev.com>:
> 
> The problem is that you cannot cancel the page navigation in the widget,
> not even by using simple JavaScript (unbeforeunload).
> 
> Find below instead a way to "revert" the navigation. If you don't want to
> hide the widget you can similarly use two widgets and change their layer.
> Or you can show a snapshot of the current page while hiding the widget
> that already shows the new page. 
> 
> local flc="forums.livecode.com", qURL
> 
> on browserNavigateComplete pUrl
>  if not (pURL contains flc) then
>    answer "Leave the forum?" with "yes" or "no"
>    if it is "no" then 
>      send "resetURL" to me in 3 ticks
>    else show widget 1
>  end if
> end browserNavigateComplete
> 
> on browserNavigateBegin pUrl
>  if pURL contains flc then
>    put the url of widget 1 into qURL
>  else hide widget 1
> end browserNavigateBegin
> 
> on resetURL
>  set the url of widget 1 to qURL
>  show widget 1
> end resetURL
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list