Skip to content
Related Articles

Related Articles

Improve Article

JavaScript URIError | Malformed URI Sequence

  • Last Updated : 19 Aug, 2020
Geek Week

This JavaScript exception malformed URI sequence occurs if the encoding or decoding of URI is unsuccessful.

Message:

URIError: The URI to be encoded contains invalid character (Edge)
URIError: malformed URI sequence (Firefox)
URIError: URI malformed (Chrome)

Error Type:

URIError

Cause of the Error: This error is thrown as somewhere in the code, the URI encoding or decoding is unsuccessful.

Example 1: In this example, the value passed is not acceptable, therefore the error has occurred.



HTML




<script>
  // Error here
  encodeURI('\uD810');
</script>

Output:

URIError: URI malformed

Example 2: In this example, the value passed is not acceptable, therefore the error has occurred.

HTML




<script>
  // Error here
  decodeURIComponent('%E0%B4%A'); 
</script>

Output:

URIError: URI malformed

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!

My Personal Notes arrow_drop_up
Recommended Articles
Page :