Cropper: `crossOrigin` attribute breaks functionality on non-standard ports

Created on 3 Dec 2014  路  5Comments  路  Source: fengyuanchen/cropper

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?

Most helpful comment

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

All 5 comments

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. 

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?

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.

hey this looks great! thanks :)

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kickthemooon picture kickthemooon  路  9Comments

ThameDBA picture ThameDBA  路  4Comments

Kendokai picture Kendokai  路  4Comments

rajjanorkar picture rajjanorkar  路  4Comments

JSteunou picture JSteunou  路  7Comments