-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Conversation
…ing certain requests
…event mailto and tel links from triggering popups
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(); | ||
} | ||
}); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Fix string formatting in test_e2e.py
MailtoTelBlockerHandler
to intercept and blockmailto:
andtel:
links at the network level.mailto:
andtel:
links.