danzen / zimjs

ZIM JavaScript Canvas Framework - Code Creativity! Interactive Media For All.
Other
507 stars 47 forks source link

Frame LoadAssets Problem #30

Closed cloudchentrial closed 5 years ago

cloudchentrial commented 5 years ago

Hi, I have seen your tutorials video - ZIM CAPTURE loadAssets. and i got some problem on Chrome.

Access to XMLHttpRequest at 'file:///D:/Javascript%20project/zimJS_001/assets/people.jpg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. createjs_1.1_min.js:29 Uncaught TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided. at t.e._formatImage (createjs_1.1_min.js:29) at t.e.handleEvent (createjs_1.1_min.js:29) at createjs_1.1_min.js:29 at t.e._dispatchEvent (createjs_1.1_min.js:29) at t.e._dispatchEvent (createjs_1.1_min.js:29) at t.e.dispatchEvent (createjs_1.1_min.js:29) at t.e._handleLoad (createjs_1.1_min.js:29) at t.e._handleReadyStateChange (createjs_1.1_min.js:29) at XMLHttpRequest. (createjs_1.1_min.js:29) at t.e.load (createjs_1.1_min.js:29)**

danzen commented 5 years ago

Hi Hanley - I am hoping that problem is the traditional "viewing local graphics on the canvas" issue. You can set Chrome to ignore that. Here are the instructions - they can also be found in the assets template example. https://zimjs.com/templates/assets.html

// NOTE - loading assets into a local file causes security issues in Browswers // this problem does not occur once the files are on a server

// ON FIREFOX: // type: about:config into your Browser URL bar // search for security.fileuri.strict_origin_policy and double click it to set it to false

// ON PC CHROME: // To test locally, find your Chrome icon or shortcut, right click and choose properties // then under Target, adjust your target to include --allow-file-access-from-files (after the quotes) // eg. "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files // YOU MUST OPEN CHROME WITH THIS ICON - then go to your file.

// ON MAC CHROME: // open your terminal anywhere, make sure Google Chrome is currently not running // copy paste this line and hit enter: // open /Applications/Google\ Chrome.app --args --allow-file-access-from-files

// once again, there is no problem for end users when the files are on a server

cloudchentrial commented 5 years ago

@danzen gotit. thanks so much. =>