Cross-origin error in canvas html5 kineticJS using path file:// - html

I want to create image from my canvas, I'm using kineticjs, but I get error: "Kinetic warning: Unable to get data URL. Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported." I suppose, that it's caused by cross-origin error. In canvas I use localy saved images and address path starts with "file://..". Is there any solution how to create image without apache installing? Thanks.

Your local hard drive is deemed to be "other domain" by browsers and will taint Canvas.
That's a good thing! You don't want malicious code to get at stuff on your personal drive.
Some workarounds:
Install a web server on your computer.
Put your image(s) and all files associated with your web app on the desktop (this may/may not help depending on where you got the images to begin with).
Temporarily host your images on a site that allows anonymous cross-origin access to your images.

Related

html frames fails when referenced with file:///

I have a large set of html files that I keep on my windows 10 system that I have not used in a long time. They use frames and I access them using the file:/// mechanism. These no longer works in firefox or chrome but do work with edge. I believe this is due to cross origin frame problem referenced here
SecurityError: Blocked a frame with origin from accessing a cross-origin frame
The actual error produced is
Uncaught SecurityError: Blocked a frame with origin "null" from accessing a frame with origin "null"
I have moved enough of the pages to aws web space to verify that the pages function correctly when retrieved from a web server.
My question is...
Is there any way I can make this work from my local windows 10 system other than adding a web server to it?
Is there any way I can make this work from my local windows 10 system other than adding a web server to it?
No.

Adding media (jpg, mp3, mp4) to a web page from an outside source

I have a webserver running on a storage server and I am looking to access some of the media on it (ie. use an image from the nas as a background on the page). I have tried this with no luck:
background-image:url("file://SERVER01/Media/Family/5102.jpg");
as well as other variations, such as:
background-image:url("file:///SERVER01/Media/Family/5102.jpg");
background-image:url("file://../Media/Family/5102.jpg");
background-image:url("file:///../Media/Family/5102.jpg");
When I access the page from my laptop, the background image is broken, but if I look at the source and copy the link (Only the ones with SERVER01 in them) directly in, the image pops up fine.
What is the best way of troubleshooting this? What is the safest way of using these images without compromising the security of my server?
In order to access files on your remote server you will need to use a public facing hostname & URI, you cannot use local file paths outside of the doc root because it will not be visible to the client / website user.

Swiffy External Text Loading

I have a simple flash activity that loads its text from an external file called QA.txt using the URLLoader function. I wanted to convert this file to html5 using Google Swiffy, which I have done, expect it doesn't seem to be loading the QA.txt file anymore. I believe it says this functionality is supported on their main website, so I'm wondering why it might not be working.
Any help would be greatly appreciated!
Swiffy does indeed support URLLoader!
I think your problem is this: if you open up your converted html file in your browser and also open up the developer tools console (try hitting F12), you should see an error message along the lines of:
XMLHttpRequest cannot load .../...myText.txt. Cross origin requests are only supported for HTTP.
Because you've open up the converted html page by itself, your browser isn't letting the code in that page fetch any other files, because they aren't being treated as coming from the same origin (even though they might well be sitting in the same directory) due to the same origin policy.
To get around this, you should access the swiffy html by fetching it through a local web server, something like apache (php) or node (javascript).
(It should also be working normally if you upload it onto the internet.)

can phpMyAdmin MIME point to local file and thumbnail? file:\\

I am trying to get phpMyAdmin to show the image/link for a field that has a local path.
For example, the path of my picture is Z:/Koala.jpg.
I've setup MIME type: plain/txt and the Browser Transformation: txt/plain imagelink.
It works for online images where the picture has http:// but not for files stored on my local hard drive.
It actually shows the Z:/Koala.jpg as a link and underlined, but it won't open anything when I click. phpMyAdmin appends file:\\ but I've tried both ways and no luck. Multiple browsers too.
PS Z:/ is a mapped network drive of my Network attached storage. But it doesn't work even if I use C:/.....
What you're trying to do isn't possible. Security restrictions in modern web browsers prohibit web sites from loading resources from the local filesystem (e.g, file://).

as3 sandbox security violation with http://schemas.xmlsoap.org/soap/encoding/

I implemented a gSoap c++ webservice-server to be accessed by Flash (as3) Everything runs smooth as long as i test the .swf locally, the .wsdl is loaded fine, and the communication works, even with the server running on an external ip already.
But the moment i put that .swf online - its coming up with sandbox security violations crying about the standard - schemas like that:
Error: [strict] Ignoring policy file at http://schemas.xmlsoap.org/crossdomain.xml
due to incorrect syntax. See http://www.adobe.com/go/strict_policy_files to fix this
problem.
*** Security Sandbox Violation ***
Connection to http://schemas.xmlsoap.org/soap/encoding/ halted - not permitted from
http://mydomain.com/main.swf
Error: Request for resource at http://schemas.xmlsoap.org/soap/encoding/ by requestor
from http://mydomain.com/main.swf is denied due to lack of policy file
permissions.
Can somebody help me with that problem ?
Or is there maybe a good way to define one simple webservice-method (like stringResult =
command (stringSessionId, stringCommand, stringParams, stringResult)) without loading the
.wsdl - file ? If i had that possibility i wouldnt have to stumble about that sandbox -
stuff.
Any help appreciated.
Crossdomain policy file is absent. It should be at this location. You are able to load 'wsdl' from your local machine, because your sandbox is local trusted (i.e. most convenient sandbox). So currently I can't see any way to accomplish this in flash unless there is crossdomain policy file at the desired location.
But you can try Server Side Proxy Method for loading the wsdl.
Flash doesn't allow loading content from domains other than the one where your SWF is hosted unless those domains allow you to do it. Remote domains can choose to allow SWFs in your domain to load content from them using a crossdomain.xml policy file hosted at their web root.
Here are some sample policy files : YouTube, Twitter. Check the Adobe link on policy files to know more.
The error message "ignoring due to incorrect syntax" indicates that the policy file is present there but not well formed or has some syntax errors. But I cannot find anything at http://schemas.xmlsoap.org/crossdomain.xml.
Where is your web service hosted? What are you trying to load from http://schemas.xmlsoap.org/soap/encoding/?
Thanks for the comments. The real problem here is, that the gSoap - generated wsdl - file tries to "access" these domains all over the place, so that crossdomain - stuff is out of my hands. Anyway i solved the issue now by writing the wsdl by hand without all that wsdl gsoap mega bloating, so its just accessing the w3c.* domains and they ARE obviously crossdomained
right.