我正在使用JQuery并遇到一个问题,需要您的帮助和指导。
我想在当前的window.location.href
中以下三点进行:
如果我的?mode=ssl
window.location.href
如果&mode=ssl
window.location.href
我想从logout
删除window.location.href
个查询字符串,如果存在,
然后将mode=ssl
添加到window.location
。
答案 0 :(得分:0)
尝试使用Query String Object插件。
答案 1 :(得分:0)
您希望为jQuery使用query插件的内容。使得操作和检索url查询值变得简单易行。因此,使用查询来满足您的要求:
// no need to check for a query string and use `?` or `&`, query does that for us
$.query.set("mode", "ssl");
if ($.query.get("logout")) {
$.query.set("logout", false);
}