Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Handling of target="_blank" links in kiwix-serve is not working properly inside the viewer #678

Closed
benoit74 opened this issue May 28, 2024 · 3 comments · Fixed by kiwix/libkiwix#1176
Assignees
Milestone

Comments

@benoit74
Copy link

ZIM: mes-quartiers-chinois_fr_all_2024-05 on dev.library.kiwix.org
Scraper: warc2zim 2.0.0-dev8 + zimit 2.0.0-dev5 + Browsertrix crawler 1.1.3
Browser: Firefox 126.0 on Mac OS Sonoma 14.5

When clicking on a link with target="_blank", this opens the href link both in a new browser tab and in current tab (replacing the whole tab content, not just the viewer iFrame).

Sample URL: https://dev.library.kiwix.org/viewer#mes-quartiers-chinois_fr_all_2024-05/mesquartierschinois.wordpress.com/2014/07/18/que-faire/

Search for "deux solitudes" link and click it.

image

image

When browsing without the iFrame (e.g. https://dev.library.kiwix.org/content/mes-quartiers-chinois_fr_all_2024-05/mesquartierschinois.wordpress.com/2014/07/18/que-faire/), behavior is normal / as expected.


Nota: with Chrome 125.0 on Mac OS Sonoma 14.5, it does not opens a new tab at all, it stays in same tab (probably still not correct).


This is similar to #591 but still different.

@veloman-yunkan
Copy link
Collaborator

I can't reproduce the issue as reported. Note that I am using the newer ZIM file mes-quartiers-chinois_fr_all_2024-12 that is now available on http://dev.library.kiwix.org however I don't know to what extent that change explains the differences outlined below:

  1. It seems that at the time of submitting this ticket external link blocking was not yet activated on https://dev.library.kiwix.org/ (or for some reason the link was not recognized as external). Now clicking the link loads the external link interceptor page in the current tab. Should that be fixed?
  2. Serving the said ZIM file in local kiwix-serve without external link blocking behaves the same way¹ in Firefox and Chromium (loads the external page in the current tab, no new tab is opened). I will try to fix that.

¹ as long as the handling of link clicking is concerned, see #726 for another bug discovered while working on this ticket.

@benoit74
Copy link
Author

I confirm that I can't reproduce the issue of the "two tabs opening" with the new ZIM.

However, the target="_blank" is still not handled properly in both situations:

  • without external links blocked, there is no new tab/window which is definitely wrong
  • with external links blocked, the message about external link being blocked should even probably been opened in a new tab/window (but this is probably a bit arguable)

@veloman-yunkan before you loose too much time on this issue, did you confirmed the problem happens as well on a plain simple HTML page? I do not recall if I did this. I'm a bit concerned the problem might be linked to JS of this particular ZIM/page which badly cooperate with the viewer JS.

@veloman-yunkan
Copy link
Collaborator

@veloman-yunkan before you loose too much time on this issue, did you confirmed the problem happens as well on a plain simple HTML page? I do not recall if I did this. I'm a bit concerned the problem might be linked to JS of this particular ZIM/page which badly cooperate with the viewer JS.

I created a minimal test case demonstrating that the bug is present on a simple plain HTML page too. Going to fix it now.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants