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.
Basic support added in r19538: the URL shows up as a link in the top bar.
TODO:
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?
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.
@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
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.
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1862