Browser widget - is there something similar to browserBeforeNavigate

hh hh at
Mon May 6 08:24:11 EDT 2019

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="", 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

More information about the use-livecode mailing list