

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
toDataURL throw Uncaught Security exception in HTML
To solve the Uncaught Security Exception, you need to add the crossorigin attribute:
<img id = "myid" crossorigin = "anonymous" src="https://www.tutorialspoint.com/images/seaborn-4.jpg?v=2"> function getBase64() { var myImg = document.getElementById("myid"); var c = document.createElement("canvas"); c.width = myImg.width; c.height = myImg.width; var context = c.getContext("2d"); context.drawImage(img, 0, 0); var dataURL = c.toDataURL("image/png"); alert(dataURL.replace(/^data:image\/(png|jpg);base64,/, "")); } getBase64();
- Related Questions & Answers
- Customizing termination behavior for uncaught exception In C++
- Throw Custom Exception in Kotlin
- How to throw a C++ exception?
- How to throw custom exception in Kotlin?
- Can a constructor throw an exception in Java?
- While chaining, can we throw unchecked exception from a checked exception in java?
- Is it possible to throw exception without using "throws Exception" in java?
- How do I manually throw/raise an exception in Python?
- What is the difference between throw e and throw new Exception(e) in catch block in java?
- How to throw an exception from a static block in Java?
- Can the abstract methods of an interface throw an exception in java?
- Can we throw an Unchecked Exception from a static block in java?
- How do you throw an Exception without breaking a for loop in java?
- While overriding can the subclass choose not to throw an exception in java?
- How can I get a JavaScript stack trace when I throw an exception?
Advertisements