How to configure WebView to allow getImageData on canvas from local or remote files?

In my application, I have a WebView, and I would like to disable the security function, not allowing ctx.getImageDataon the canvas where the image was drawn from the local ( file://url) machine.

To enable this setting, the policy delegate does not seem to exist. Now I can implement the server in my application to act as a proxy server, but this seems like an unnecessary one. How do i solve this?

+3
source share
4 answers

The solution is relatively simple:

  • Download the webkit source.
  • Comment on these lines (1558 - 1561):

    if (!canvas()->originClean()) {
         ec = SECURITY_ERR;
         return 0;
    }
    
  • Build.

  • Add it as a frame in Xcode.
-1
source

uri data:? :

data:text/html;base64,PGgxPlRoZSBNYWdpYyBXb3JkcyBhcmUgU3F1ZWFtaXNoIE9zc2lmcmFnZTwvaDE+

.

0

, :

+[WebView registerURLSchemeAsLocal:]

, URL- http:, WebKit http-, .

, , . , URL . .

, , ?

0

WebView.setAllowFileAccessFromFileURLs .

0

Source: https://habr.com/ru/post/1784382/


All Articles