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

Use generic event listener for link processing #732

Open
Jaifroid opened this issue Jun 13, 2021 · 1 comment
Open

Use generic event listener for link processing #732

Jaifroid opened this issue Jun 13, 2021 · 1 comment
Assignees
Milestone

Comments

@Jaifroid
Copy link
Member

This is point 1 discussed in #725. Rather than a new feature for jQuery, I see it as code cleanup, and it will prevent seeing so many "violations" for adding non-passive event listeners to hundresds of document links that show up in the Chromium console. Instead, we add a single onclick event listener on the iframe's contentWindow. Then we use almost exactly the same code as we currently have to analyse the clicked link. So changes would be minor.

It's the same solution as proposed for Option 2 of #404, except that of course for SW mode the function would only intervene if the user has clicked a link that navigates away from the document. The code for this could be re-used between both modes, or not used at all for SW mode if it is determined not to be safe.

I did bash together a prototype yesterday (it only took 15 minutes) as a quick test for how Option 2 of #404 would work, but if not used there, the same principle can be used for this PR. It is in branch Check-for-external-links-and-warn and only works in SW mode to check for external links and asks the user if they want to access the site. It can be used for testing the viability of #404, but also for testing the principle of this PR before writing any more code.

@Jaifroid Jaifroid self-assigned this Jun 13, 2021
@Jaifroid Jaifroid changed the title Use generic event listener for link processing in jQuery mode Use generic event listener for link processing Nov 21, 2021
@Jaifroid
Copy link
Member Author

Jaifroid commented Nov 21, 2021

As discussed at the Hackathon, we may be forced to apply some link processing in SW mode to enable opening external links in a new tab or window. The method outlined above (minimized for the single requirement of opening external links) could be used for this purpose.

@Jaifroid Jaifroid added this to the v3.5 milestone Jan 31, 2022
@mossroy mossroy modified the milestones: v3.6, v3.5 May 8, 2022
@mossroy mossroy modified the milestones: v3.5, v3.6 Aug 4, 2022
@Jaifroid Jaifroid modified the milestones: v3.6, v3.7 Nov 9, 2022
@Jaifroid Jaifroid modified the milestones: v3.7, v3.8 Jan 3, 2023
@Jaifroid Jaifroid modified the milestones: v3.8, v3.9 Apr 22, 2023
@Jaifroid Jaifroid modified the milestones: v3.11, v4.0 Nov 1, 2023
@Jaifroid Jaifroid modified the milestones: v4.0, v4.1 Feb 21, 2024
@Jaifroid Jaifroid modified the milestones: v4.1, v4.2 Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants