Skip to content

Links in mobile version / window.open / href target

By adding a signal to the parameterles onOpenUrlInNewWindow 1 2 I managed to draw these conclusions:

  • on touch interface, links come in as onLinkClicked(url) then onOpenUrlInNewWindow()
  • on mobile interface, only the latter comes.

(Assumption: the first is using a href with a target, the latter just window.open?)

This also explains why: there is no need to return false or anything in the onLinkClickedHandler - the link will be followed or not based on weather it has a target. Good for us. But it makes it almost impossible3 to implement opening links in the mobile interface now.

It could be used to open t.f.c/photo/view_full_size/ photos in a separate page maybe.

  1. https://github.com/sailfishos/sailfish-components-webview/blob/master/import/webview/rawwebview.h#L55

  2. https://github.com/sailfishos/sailfish-components-webview/pull/102/files#r633423810

  3. "impossible" may be just a runJavaScript call onLoadedChanged where we replace window.open

Edited by Vlad G.