Skip to content
This repository has been archived by the owner on Aug 1, 2020. It is now read-only.

crossOrigin attribute breaks functionality on non-standard ports #119

Closed
nchase opened this issue Dec 3, 2014 · 5 comments
Closed

crossOrigin attribute breaks functionality on non-standard ports #119

nchase opened this issue Dec 3, 2014 · 5 comments

Comments

@nchase
Copy link
Contributor

nchase commented Dec 3, 2014

If I'm running a web server locally on port 3000 (or any port other than 80), and try to use cropper with an image from the web, cropper generates a 'Cross-Origin Resource Sharing policy' error.

If I remove the crossOrigin attribute code on L152, this error doesn't happen and the image gets appended appropriately.

Can we make the crossOrigin attribute optional?

@fengyuanchen
Copy link
Owner

If a cross-domain image misses the crossOrigin attribute, you willn't be able to export it from a canvas after you drawed it in, so when you call the getDataURL or rotate methods of the plugin, you will get a SecurityError error like this:

Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported. 

@nchase
Copy link
Contributor Author

nchase commented Dec 4, 2014

if a cross-domain image misses the crossOrigin attribute, you willn't be able to export it from a canvas after you drawed it in

but what if I'm not using a canvas? am I missing something here?

@fengyuanchen
Copy link
Owner

All right! I can support this feature for someone who does not need the getDataURL and rotate methods, I will support this by add a new option.

@nchase
Copy link
Contributor Author

nchase commented Dec 6, 2014

hey this looks great! thanks :)

@lalaBao
Copy link

lalaBao commented Dec 16, 2017

It is a cross-domain image, and I need use canvas method : getDataURL ,what should I do?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants