I am loading the page into QWebView like so,
QWebView::setHtml(content, QUrl("file://"));
The content includes something like,
<img src="file:///F:\\foo.png">
I then try to do this in JS:
var canvas = document.querySelector("canvas");
var cxt = canvas.getContext("2d");
var image = document.querySelector("image");
cxt.drawImage(image, 0, 0);
var imgData = cxt.getImageData(1, 1, 1, 1);
This doesn’t work, apparently due to a SameOrigin error because if I just add,
settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true);
then it works fine, except I don’t want to do this since it’s a general security concern…
But since the page is loaded with base “file://” and the file is being loaded from “file://” … how is this a SameOrigin conflict!?
Can anybody explain what I’m missing?
(I’m using Qt 4.8.4.)
↧