如何安全地使用JavaScript对URL进行编码,以便将其放入GET字符串中?
var myUrl = "http://example.com/index.html?param=1&anotherParam=2";
var myOtherUrl = "http://example.com/index.html?url=" + encodeURIComponent(myUrl);
我猜您需要在第二行对myUrl变量进行编码?
如何安全地使用JavaScript对URL进行编码,以便将其放入GET字符串中?
var myUrl = "http://example.com/index.html?param=1&anotherParam=2";
var myOtherUrl = "http://example.com/index.html?url=" + encodeURIComponent(myUrl);
我猜您需要在第二行对myUrl变量进行编码?