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

🚫 Prevent email popups from mailto: and tel: links #70

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

mohamedmamdouh22
Copy link
Collaborator

  • Implemented MailtoTelBlockerHandler to intercept and block mailto: and tel: links at the network level.
  • Added JS-based click prevention to stop client-side interaction with mailto: and tel: links.
  • Enhanced E2E tests to verify that popups and navigation for email and phone links are properly blocked.
  • Verified no dialogs or popups are triggered during user interactions with these links.

Copy link

linear bot commented Sep 19, 2024

Comment on lines +364 to +372
if harness == playwright_harness:
await page.wait_for_load_state("domcontentloaded")
await page.evaluate("""
document.addEventListener('click', (event) => {
const target = event.target.closest('a[href^="mailto:"], a[href^="tel:"]');
if (target) {
event.preventDefault();
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this if we have the route handler already?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the route handler will prevent the request from being sent, but it will not prevent the js code from being executed so the popup window will still appear, using this code, it will prevent the js code itself from opening a new window since its href starts with mailto or tel. @asim-shrestha

@mohamedmamdouh22 mohamedmamdouh22 marked this pull request as ready for review October 23, 2024 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants