-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Sites like Dollar Country embed the libsyn player. The play button is a link whose href is inline javascript, i.e. href="javascrip:void[0];" [sic].
If you try to click this type of link using an element's click method, you'll get a CSP error like:
Refused to run the JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self' 'wasm-unsafe-eval' 'inline-speculation-rules' http://localhost:* http://127.0.0.1:*". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present.
Sadly, you cannot just surround this type of error in a throw/catch block, rather you have to listen for a particular error, which means you can't make the original click process continue.
I'm kind of grasping at straws for solutions here, but perhaps we can:
- Detect that there is javascript in the
href. - Find the element's
clickhandlers and save them to a local variable. - Remove the
hreffrom the element. - Reregister the
clickhandlers, perhaps inside a wrapper that issuesevent.preventDefault.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working