Skip to content
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

External links of noted.lol do not open properly #413

Open
benoit74 opened this issue Oct 29, 2024 · 3 comments
Open

External links of noted.lol do not open properly #413

benoit74 opened this issue Oct 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@benoit74
Copy link
Collaborator

See e.g. https://library.kiwix.org/content/noted.lol_en_all_2024-10/noted.lol/convert-any-website-into-a-zim-file-zimit/

At the bottom of the article, we have a link to Zimit GitHub repository

This link does not open properly on kiwix-serve. Same behavior observed on Apple and PWA, so this really looks like an issue with wombat intercepting the click event and doing nasty things.

@benoit74 benoit74 added the bug Something isn't working label Oct 29, 2024
@rgaudin
Copy link
Member

rgaudin commented Oct 29, 2024

urlRewriten:
	- current_url: https://library.kiwix.org/content/noted.lol_en_all_2024-10/noted.lol/convert-any-website-into-a-zim-file-zimit/
	- orig_host: noted.lol
	- orig_scheme: https
	- orig_url: https://noted.lol/convert-any-website-into-a-zim-file-zimit/
	- prefix: https://library.kiwix.org/content/noted.lol_en_all_2024-10/
	- url: https://github.com/openzim/zimit?ref=noted.lol
	- useRel: false
	- mod: undefined
	- doc: undefined
	- finalUrl: https://library.kiwix.org/content/noted.lol_en_all_2024-10/github.com/openzim/zimit%3Fref%3Dnoted.lol
	[wombatSetup.js:2:18356](https://library.kiwix.org/content/noted.lol_en_all_2024-10/_zim_static/wombatSetup.js)

@kelson42
Copy link
Contributor

lol ;)

@benoit74
Copy link
Collaborator Author

Indeed !

Original website:

<script type="text/javascript">
    var links = document.querySelectorAll('a');
    links.forEach((link) => {
        var a = new RegExp('/' + window.location.host + '/');
        if(!a.test(link.href)) {
          	link.addEventListener('click', (event) => {
                event.preventDefault();
                event.stopPropagation();
                window.open(link.href, '_blank');
            });
        }
    });
</script>

So all links are handled through javascript ... and hence dynamically rewritten even if we decided not to during static rewriting ...

Not sure how we can handle this, after all, we've said that all calls made from javascript must be rewritten for proper operation ...

Should we add a tweak in the static rewriting that can then be seen and used in dynamic rewriting so that we know we've already rewritten the link for sure and we've made the decision to not rewrite it?

Should we add yet another configuration switch to warc2zim to be able to configure when we do not want to inject wombat into a script like this (but it is hard to specify which script we want to ignore since it has no ID?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants