Xpra: Ticket #1862: html5 client to support forwarding of url open requests

We can't just open a URL whenever we want because the browser's anti-popup feature will just block it.

So we would need to dock the request in the top bar (#1670) and the user can then click on it there.



Wed, 30 May 2018 14:04:43 GMT - Antoine Martin: status, description changed


Wed, 30 May 2018 14:50:17 GMT - Antoine Martin:

Basic support added in r19538: the URL shows up as a link in the top bar.

TODO:


Mon, 04 Jun 2018 16:37:37 GMT - Matteo Ipri:

I tried the beta version v2.4-r19555 on Ubuntu 17.10 artful. It works as expected, thanks! My comments:

With my colleague Andrea Succi, we found a solution for opening the links on clicks. You need to allow pop-ups, though.

We added this in Client.js, before the call to console.log():

    postMessage(url, "*");

And this in index.html, as last <head> item:

    <script >
       window.addEventListener('message',function(event) {
       console.log('message received:  ' + event.data, event);
       window.open(event.data, 'links-matlab');
       },false);
    </script>

If xpra HTML5 client is embedded in an iframe, the line in Client.js becomes:

    parent.postMessage(url, "*");

What do you think of this solution?


Mon, 24 Sep 2018 17:24:11 GMT - Antoine Martin: status changed; resolution set

we found a solution for opening the links on clicks. You need to allow pop-ups, though.

Almost all browsers will (mostly silently) block all popups, so this is not a solution. I've switched to using notifications in r20524. Those are clearly visible and there is enough space to see the full URL.

I don't like the idea of shortening URLs automatically as we have no way of knowing exactly how to shorten them: just the domain? at the query string?

This works as intended in this ticket so I am closing, feel free to open a new ticket for enhancements.


Mon, 01 Oct 2018 19:44:04 GMT - Mark Harkin:

@Antoine if you want to use the action-link that's fine. I've found window.open(url, '_blank') works well though, and don't think it is caught by popup blockers. Also breaks nicely out of fullscreen (in Chrome at least).

Diff @ https://github.com/mjharkin/Xpra/commit/4a203f0ad701db2456e00c4b15d1d13c8f5171e0


Tue, 02 Oct 2018 04:58:30 GMT - Antoine Martin:

I've found window.open(url, '_blank') works well though, and don't think it is caught by popup blockers.

window.open is exactly what popup blockers are restricting: most browsers block popups if they are called outside of user-triggered event handlers like onclick. As for target="_blank", that's what we already use.

Feel free to submit a patch to add a connect dialog option so the user can select this alternative code path instead of using notifications, but this cannot be made the default.


Sat, 23 Jan 2021 05:35:45 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1862