The error message displayed is: "Uncaught TypeError: Unable to execute 'createObjectURL' on 'URL': Overload resolution failed"

I'm encountering an issue when using file saver and html2canvas that displays the following error message. How can I resolve this?

Uncaught TypeError: Failed to execute 'createObjectURL' on 'URL': Overload resolution failed.

$( "#click" ).on( "click", function() {
    html2canvas(document.querySelector("#Views")).then(canvas => {
      canvas.toBlob(function(blob) {

        window.saveAs(blob, 'img.jpg');
      });
      });
  });

Answer №1

If you encounter this error, it means that the attempt to use HTMLCanvasElement#toBlob() has failed due to a few possible reasons:

  • The canvas that was returned had either its height or width set to 0:

document.querySelector("canvas").toBlob(console.log);
<canvas width="0">

  • The area of the returned canvas exceeded the maximum supported by the browser:

document.querySelector("canvas").toBlob(console.log);
<canvas width="80000" height="80000">

To troubleshoot, make sure to check the computed style of your element, paying close attention to its size and also its display value. Often, this issue arises when trying to manipulate an element with display: none.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Dealing with errors using Javascript and Node.js (then/catch)

Suppose I have the following pseudocode in my routes.js file: var pkg = require('random-package'); app.post('/aroute', function(req, res) { pkg.impl_func(data, function (err, result) { myFunction(entity).then(user=>{ ...

The Workbench has "Rejected the setting of an insecure header 'content-length'"

While working on implementing a simple xhr abstraction, I encountered a warning when trying to set the headers for a POST request. Strangely, I noticed that the issue might be related to setting the headers in a separate JavaScript file. This is because wh ...

What is the correct way to insert a Vimeo video into an HTML document?

When embedding a YouTube video in HTML, the <iframe src="https://youtube.com/embed/videoId> element is used. But what about when you want to embed Vimeo videos using the <iframe> element? ...

How can we effectively use mongoose populate in our codebase?

Hey there, I'm a newbie when it comes to nodejs and mongoose, and I could really use some assistance with mongoose populate. Can someone please help me understand this better? Thanks in Advance! Here are the schemas I'm working with: PropertySch ...

Tips for refining the data displayed on your Kendo Grid

I have implemented a Kendo grid in my view and I am looking to apply filters to the data displayed on the grid. The grid is populated from a list within my model. @(Html.Kendo().Grid(Model.list) .Name("listgrid") .Columns(columns => { ...

The annoying Facebook "add a comment" popup refuses to close

Occasionally, the "add a comment" popup (iframe) in Facebook's Like plug-in fails to close and obstructs access to the content underneath. This issue has been noted while using Chrome 21 and Firefox 15. To replicate this problem, you can visit the fo ...

Challenges related to using the require() method in JavaScript

I've been encountering an issue while trying to run the JavaScript client for the Tumblr API from their Github repository. The error message I keep getting is "require not defined" which has led me on a hunt across various forums and websites, includi ...

The raycaster's intersectObjects function consistently results in an empty array

I've been working on implementing a raycaster to find intersections, but no matter what I do, it always gives back an empty array. Here's how I add objects to my objects array: var obstructionGeom = new THREE.BoxGeometry(6,5,0.5); var obstructi ...

Utilizing JSON for Google Charts

Although I have no prior experience with Google Charts, I am currently attempting to graph temperature data collected from sensors placed around my house. Unfortunately, I keep encountering an Exception error. I suspect the issue lies in the JSON format no ...

Hypertext Abstract Markup Language: Generating a data-xxx-yyy attribute

Creating a link with data-* attribute is simple: %a{ :href => "#", :data => { :name ="John", :age => 24 } } Hi John This will generate: <a href="#" data-name="John" data-age="24">Hi John</a> What about nesting data attributes? For ...

An in-depth guide on implementing debounce functionality for `keyup` events in Vue.js

I am attempting to detect when the user begins typing and stops typing using the debounce function. I experimented with Lodash and Underscore.js. On my textArea v-on:keyup="handler($event)" handler: function(e) { ...

VS Code lacks autocomplete intellisense for Cypress

I am currently using Cypress version 12.17.1 on VS Code within the Windows 10 operating system. My goal is to write Cypress code in Visual Studio Code, but encountered an issue where the cypress commands that start with cy are not appearing as auto-comple ...

Timeout error of 10000ms occurred while using await with Promise.all in Mocha unit tests

Document: index.ts // Default Exported Classes getItemsA() { return Promise.resolve({ // Simulating API call. Mocking for now. success: true, result: [{ itemA: [] }] }); } getItemsB() { return Promise.resolve({ // Simulating API cal ...

Establishing a global variable in Cypress through a function

My current workflow involves the following steps: 1) Extracting a field value from one page: var myID; cy.get('#MYID'). then(($txt) => { myID= $txt.text(); }) .should('not.equal', null); 2) Mo ...

Having numerous bxsliders implemented in a Genesis child theme

I'm currently working on incorporating multiple bxsliders through custom fields in a wp genesis child theme. The initial slider was successfully implemented using the following function within the genesis child theme functions: add_action('genes ...

How can I seamlessly combine CoffeeScript and TypeScript files within a single Node.js project?

When working on a server-side node project utilizing the standard package.json structure, what is the best way to incorporate both Coffeescript and Typescript files? It's crucial that we maintain the availability of npm install, npm test, and npm sta ...

Guide on executing searches on 2 separate collections with pagination in MongoDB

I am currently working with two collections: Users and Posts. I attempted to use the find() method on both collections and then concatenate the results. However, I encountered a problem when it came to pagination. My main inquiry is how can I accomplish th ...

The Javascript driver allows me to search MongoDB's vast database of 500 million documents using regular expressions on two specific fields, without relying on a predefined schema

My MongoDB database contains approximately 500 million documents structured like this: { "_id": objectId, "Name": "John Smith", "Address": "132, My Street, Kingston, New York 12401" } I am looking to ...

What is the proper way to use special characters like "<>" in a parameter when sending a request to the server using $.ajax?

Upon submission from the client side, a form is sent to the server using $.ajax: function showSearchResults(searchText, fromSuggestions) { $.ajax({ url: "/Home/Search", data: { searchText: searchText, fromSuggestions: fromSuggestions } ...

Guide on inserting HTML text box form input into Express route parameter

I'm currently working on implementing a feature that allows users to search through my mongo database using an endpoint structured like this: app.get('/search/:input', function(req, res){ console.log(`get request to: /members/${req.params ...