Launch vs Set in widget

hh hh at hyperhh.de
Sun Sep 1 02:40:55 EDT 2019


Originally such things could be used to "redirect" urls.
But in the current browser widget this is not used and in fact there
is no difference between the two:

[ The LCB code is
public handler OnLaunchUrl(in pUrl as String)
  setUrl(pUrl)
end handler ]

But I have meanwhile found a solution you could try. Works here on
desktop and mobile.

The script below disables going back in the browser and keeps the
history clean. It preserves the state of your stack, which is the
same as if you navigate back from another page.

Hopefully the backKey doesn't has its own history (couldn't test here).

=== DISABLE GOING BACK IN BROWSER ===

You have to do that each time you go to a new page.

• For example I use it as follows in a browser widget.

on browserNavigateComplete uri
  do "history.pushState(null, document.title, location.href);" & \
     "window.addEventListener('popstate', function (event){" & \
     "history.pushState(null, document.title, location.href); });" \
     in widget "browser"
end browserNavigateComplete

• In a HTML5 standalone you can write

  do "history.pushState(null, document.title, location.href);" & \
     "window.addEventListener('popstate', function (event){" & \
     "history.pushState(null, document.title, location.href); });" \
     as "javascript"


> JLG wrote:
> Yes, I meant "launch url in widget" which says it opens a url in the 
> widget, but that is what "set the URL of widget x" does too. I don't see 
> any difference.
> 
> I'm having a terrible time with both acceleratedRendering and the browser 
> widget in LC 9.5. I can't fix acceleratedRendering but I think I'll try 
> going back to the original mobileCreate method and see if that works 
> better. On my Pixel the widget freezes and Android puts up its "not 
> responding" error dialog after the user navigates around a few pages. It 
> doesn't behave correctly when changing stacks and remains visible after the 
> new stack opens, obscuring the card. It also freezes when the back history 
> is exhausted. I was curious if setting the URL with its launch command 
> would be different.
> 
> I badly need to be able to respond to the backKey too, but apparently 
> that's not possible. The widget eats it. As for acceleratedRendering, it's 
> broken. I had to turn it off completely.
> 
> I'm stuck with 9.5 because I have to build for 64-bit.





More information about the use-livecode mailing list