VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-revokeobjecturl-method/

⇱ HTML DOM revokeObjectURL() method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML DOM revokeObjectURL() method

Last Updated : 12 Jul, 2022

The URL revokeObjectURL() method releases an existing object URL which was created by using URL createObjectURL(). This method is called when you are finished using an object URL and don't want the browser to keep the reference to that file any longer.

Syntax:

URL.revokeObjectURL(objectURL);

Parameters:

  • objectURL: A DOMString object URL to be released.

Return Value: This method has no return value.

Example: In this example, create an objectURL using createObjectURL() method and then revoked it.

Output:

Before Choosing Image:

👁 Image

After Choosing Image: In the console, an error can be seen that "Not allowed to load local resource" as the URL is revoked.

👁 Image

Checking the Object URL will also give "File not found":

👁 Image

Supported Browsers:

  • Google Chrome 19
  • Edge 12
  • Firefox 19
  • Safari 6
  • Opera 15
  • Internet Explorer 10
Comment
Article Tags:
Article Tags: