0
我有两个不同的查询字符串:?pid=
和?ref=
。目前我使用window.history.pushState
添加查询字符串。我如何检查是否有查询字符串,以避免?pid=foo?ref=bar
而不是?pid=foo&ref=bar
?如何检查查询字符串是否已经存在
当前代码:
if (!!$.cookie('myrefcookie')) {
var myref = $.cookie("myrefcookie")
var target = window.location.href + '?ref=' + myref;
window.history.pushState(null, null, target);
}