crittermike / shortkeys

A browser extension for custom keyboard shortcuts
https://www.shortkeys.app/
Other
975 stars 159 forks source link

CSP problem with Run JavaScript behavior in Firefox (OK in Chrome) #483

Open JohnVeness opened 2 years ago

JohnVeness commented 2 years ago

Hello. I'm trying to set a shortcut key to click on a button with a particular text on a website. The JS code is:

document.evaluate("//span[text()='Upgrade the tags']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.parentElement.parentElement.click();

However, if I try this (after assigning it to a key in ShortKeys Options), it does no effect in Firefox. Looking in the console, I see the error:

Content Security Policy: The page's settings blocked the loading of a resource at inline ("script-src").

Doing the same in Chrome has no such problems.

The site I'm trying this on is openstreetmap.org (specifically, the editor) - you would need to create an account there if you wanted to test this.

Any ideas on why this isn't working in Firefox?

Many thanks for this extension :)

TonyFeestneus commented 1 year ago

Same here, have not figured out a solution yet.