-
-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Open in New tab" does not work with local links (in Jquery) #678
Comments
@kelson42 We don't have any logic to decode an article and all assets in a shadow DOM and then transfer the HTML to a new tab. I implemented a "breakout link" in KJSW which transfers a copy of the currently loaded article (including images loaded as data URIs) into a new tab (with no Kiwix chrome) for bookmarking an article or side-by-side comparison, or for better printing. But the extracted HTML and images are not navegable, it is a static copy of the article DOM. Going further than that would require the ability to track and communicate between tabs, and quite a lot of extra logic to manage tabs. Are you suggesting we try to disable the built-in browser behaviours for ctrl-click or right-click "open in new tab"? |
I primarly report a behaviour which is not really nice for user (actually this is a report from a user). I suspect that, if we can open a ZIM file without going through the "open file" dialog (which is #656 if I'm right), then we should be in position to open a new Kiwix-JS an open the right ZIM file at the right place. There is as well an obvious "problem" around the URLs to manage. If that would really not work we might think about catching the click event via JQuery or SW. But again, would be sad to have to follow that path. |
OK, I'll investigate. |
@kelson42 I've investigated a bit, and it is technically possible to open a new tab using something like:
The newWindow can be manipulated from the main window in exactly the same way as we manipulate the iframe. It is possible to navigate in I pushed a demo branch of this working pretty well in Chromium and Firefox (jQuery mode) (for Firefox, the user must explicitly allow the "popup" tab). It's very hacky (it closes tab and re-opens it for each new article, just as a kludge to make it work). It does not (currently) work at all in IE11, and works poorly in Edge Legacy (styles and images are not loaded). See: And below a sequence in action (look at tabs at top of window): |
@Jaifroid Thank you very much for moving so quickly on this. I would like to step-back for a moment and ask: why exactly this just not work out of the box? Is this because #656? Do we have another problem? We should be carefull to use as much as possible the features of the browser and not mimic them in our own code base. |
See my comment in #679. Opening in a new tab works fine and "naturally" with no kludge in Service Worker mode. My kludge above applies only to the legacy jQuery mode (and sorry for not explaining that!). But I'm glad I've discovered that it is really easy to do in the legacy mode as well! |
@Jaifroid Oh! Here as well indeed... which is a good news! I have renamed this ticket as it was confusing. Your demo looks promising if you can properly attach this new primitive to the even of opening in a new tab (it exists many ways to open a link in a new tab). |
Info to myself: it is possible to trap the More info here: https://stackoverflow.com/questions/8927208/catching-event-when-following-a-link Also some discussion about replacing context menu in #521, where it was decided it was not a great idea. |
I don't think there's a clean and universal way to trap the opening of a link in a new tab. There are many ways to open a link in a new tab, and some depend on the browser/version/settings. I personally do it with the middle-click of my mouse. Is it worth adding quirks in our code to only partially handle this in jQuery mode? |
I added middle-click support to #680 ;-) (not tested yet -- my other machine has middle mouse button, not the one I'm on right now). I think #680 addresses three potential issues with the app in its current state:
Whether it's worth it or not depends on how much of an anomaly it is not to support it. The user who reported this to @kelson42 clearly felt it was enough of an issue to be worth reporting. The lack of SW mode in the Firefox browser extension maybe makes this more of a concern than it would otherwise be. One possibility (that would also educate users on the existence of the function) would be to have a switch in Configuration:
This option would turn the feature on in jQuery mode and suppress the context menu (and would do nothing in SW mode). |
OK you convinced me. |
I think we abandoned the PR which might have implemented this. So closing for now. |
Nothing is loaded, not even the Kiwix extension.
I'm not sure if this is possible at all.
But if not possible we should probably not open a new tab for local links
The text was updated successfully, but these errors were encountered: