'Error on retrieving url in Internet Explorer

I'm having the following error in retrieving the url in IE.

I have the following code:

 var url_string = window.location.href;
 var url2 = new URL(url_string);

where url_string is:

file:///C:/Users/Desktop/Books%20List/listAuthorBook.html?id=011100&title=Hello

I get the error:

Invalid action for object

on line:

var url2 = new URL(url_string);



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source