Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SecurityError when using Data URI background-image in Safari 11.1 #1575

Closed
ryenbeatty opened this issue Jun 26, 2018 · 3 comments
Closed

SecurityError when using Data URI background-image in Safari 11.1 #1575

ryenbeatty opened this issue Jun 26, 2018 · 3 comments

Comments

@ryenbeatty
Copy link

Hi there,

When trying to render a div with a background-image property set to a Data URI in Safari, html2canvas is throwing an Unhandled Promise Rejection:
Unhandled Promise Rejection: SecurityError: The operation is insecure.

This happens after the 'Render complete' phase happens, example console logs:

image

Example source html:
<div style="background-image: url('data:image/svg+xml;base64,...');" />

Seems to be a duplicate of this issue

Thanks,
Ryen

Specifications:

  • html2canvas version tested with: 1.0.0-alpha.12
  • Browser & version: Safari 11.1
  • Operating system: macOS Sierra 10.12.16
@Mivnv
Copy link

Mivnv commented Sep 5, 2018

I've got the same error. Any updates here ?

@kxgio
Copy link

kxgio commented Sep 5, 2018

Same here with following css

background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 200 200'%3E%3Cdefs%3E%3ClinearGradient id='a' gradientUnits='userSpaceOnUse' x1='100' y1='33' x2='100' y2='-3'%3E%3Cstop offset='0' stop-color='%23000' stop-opacity='0'/%3E%3Cstop offset='1' stop-color='%23000' stop-opacity='1'/%3E%3C/linearGradient%3E%3ClinearGradient id='b' gradientUnits='userSpaceOnUse' x1='100' y1='135' x2='100' y2='97'%3E%3Cstop offset='0' stop-color='%23000' stop-opacity='0'/%3E%3Cstop offset='1' stop-color='%23000' stop-opacity='1'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cg fill='%23ca481d' fill-opacity='0.6'%3E%3Crect x='100' width='100' height='100'/%3E%3Crect y='100' width='100' height='100'/%3E%3C/g%3E%3Cg fill-opacity='0.5'%3E%3Cpolygon fill='url(%23a)' points='100 30 0 0 200 0'/%3E%3Cpolygon fill='url(%23b)' points='100 100 0 130 0 100 200 100 200 130'/%3E%3C/g%3E%3C/svg%3E");

@hex-ci
Copy link

hex-ci commented Jan 31, 2019

I've got the same error.

This problem seems to be in some browsers, inline images also need to be processed according to cross-domain images.

Related code:

if (this.options.allowTaint === true || isInlineImage(src) || this.isSameOrigin(src)) {

When I deleted isInlineImage(src) everything worked fine.

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

No branches or pull requests

5 participants