xpra icon
Bug tracker and wiki

Opened 5 months ago

Closed 4 weeks ago

Last modified 3 weeks ago

#1862 closed enhancement (fixed)

html5 client to support forwarding of url open requests

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: major Milestone: 2.4
Component: html5 Version: 2.3.x
Keywords: Cc:

Description (last modified by Antoine Martin)

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.

Change History (6)

comment:1 Changed 5 months ago by Antoine Martin

Description: modified (diff)
Status: newassigned

comment:2 Changed 5 months ago by Antoine Martin

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

TODO:

  • add option on connect page
  • make it more noticeable? (animate it somehow?)
  • should make it look better and deal with long URLs (show just the hostname part?) - ideas welcome
  • hide the link once it has been clicked?
  • could automatically open the url on the next mouseup or keyup, meh - likely not the event that triggered the url request

comment:3 Changed 5 months ago by Matteo Ipri

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

  • Yes, it needs to be more noticeable. It is a real issue with fullscreen-ed apps, where the top bar is hidden below the app and thus it seems like nothing is happening.
  • I did not test very long URLs, but I think that a shortened URL should come with the possibility to inspect the whole URL before clicking on it, maybe with some sort of alter window or by hovering with the mouse over the shortened link.
  • Automatic link opening would be great, from a user experience standpoint, maybe toggable with an option.

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?

comment:4 Changed 4 weeks ago by Antoine Martin

Resolution: fixed
Status: assignedclosed

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.

comment:5 Changed 3 weeks ago by mjharkin

@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

comment:6 Changed 3 weeks ago by 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.

Note: See TracTickets for help on using tickets.