Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 检查jquery中的url参数,并在url中附加一些内容_Javascript_Html_Jquery - Fatal编程技术网

Javascript 检查jquery中的url参数,并在url中附加一些内容

Javascript 检查jquery中的url参数,并在url中附加一些内容,javascript,html,jquery,Javascript,Html,Jquery,有没有办法检查jquery中的url参数,并通过刷新url向url追加一些内容。 因此,如果当前url路径为: var url=$(位置).attr('href'); var val=url.indexOf('view'); if(val

有没有办法检查jquery中的url参数,并通过刷新url向url追加一些内容。 因此,如果当前url路径为:

var url=$(位置).attr('href');
var val=url.indexOf('view');
if(val<0){
url+=“?视图=列表”;
window.location=url;
}
使用Push和PopState检查文章:

html5历史api,了解它。我正在研究它。但我也需要支持一些旧的浏览器。这在旧的浏览器中是不可能的。好的,我将查看html5历史记录以附加url参数
function myView() {
  // if url does not have params of view='list' {
    // update the url with http://someurl.com/test/&view=list
  } else {
    //dont update
  }
}
 var url= $(location).attr('href');
 var val = url.indexOf('view');

    if (val < 0) {

        url += "?view=list";
        window.location = url;
    }