Yellow click on images not working
LinqLover opened this issue · 2 comments
I tried it with MMBrowser openOn: 'https://github.com/cmfcmf/MagicMouse/'
, but unfortunately, yellow clicks on the images in the readme appear not to work. I also could not select images from any other site using the yellow mouse button. Is this feature broken or am I visiting the wrong sites?
Hi Christoph,
thank you for bringing this up! Indeed, accessing images from many modern websites like GitHub does not work. That's because GitHub uses a fairly restrictive Content Security Policy, which disallows many operations of the JavaScript code I inject to extract images. I have verified that it works fine on websites without or with less restrictive Content Security Policys, like https://squeak.org. Could you check whether it works for you there?
You could also enable the "Debug to Transcript" preference (I just pushed a commit that fixes preferences). You should see a stacktrace like the following when trying to extract images from websites with CSPs:
Error: Evaluation failed: DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
at img2Base64 (__puppeteer_evaluation_script__:121:19)
at extractImg (__puppeteer_evaluation_script__:141:27)
at async Promise.all (index 0)
at ExecutionContext._evaluateInternal (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/ExecutionContext.js:122:13)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
-- ASYNC --
at ExecutionContext.<anonymous> (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/helper.js:111:15)
at DOMWorld.evaluate (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/DOMWorld.js:112:20)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
-- ASYNC --
at Frame.<anonymous> (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/helper.js:111:15)
at Page.evaluate (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/Page.js:876:43)
at Page.<anonymous> (/snapshot/MagicMouse/node_modules/puppeteer-core/lib/helper.js:112:23)
at run (/snapshot/MagicMouse/run.js:632:37)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
No elements found to create a portal
(I tested this in Squeak 5.3, not sure about Squeak 6)
Hi Christian, thanks for the feedback!
I have verified that it works fine on websites without or with less restrictive Content Security Policys, like https://squeak.org. Could you check whether it works for you there?
Yes this works, great to know the feature is not broken itself.