'How to pass the entire string with the " " character in it

I'm passing some query parameters to an html page. One of these is the title where in some of these there are words with " " characters.

What I notice is that when it reaches the superscript (" ") the title is truncated.

That is, if for example I have the following title:

Chaleco López inaugurates the museum of "him"

the title parameter will be equal to: Chaleco López inaugurates the museum of (so it is incomplete because "him" is missing).

The code that does this is as follows:

var url_string = window.location.href;
var url2 = new URL(url_string);
var titolo_url = url2.searchParams.get("title");
console.log(title_url)


Solution 1:[1]

Maybe try to use these brackets '' in your title

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 cookie_pechenka