小书签将参数添加到 url 并重新提交?

bookmarklet to add a parameter to the url and resubmit it?

使用小书签可以实现以下功能吗?

  1. 向 URL 添加一个附加参数 (include_docs=true)
  2. 重新提交 URL

我有这个,但它在 Firefox 上无声无息地失败了。我还没有用其他浏览器试过:

javascript:(

   function()
   {
      key = encodeURI('include_docs'); value = encodeURI('true');

      var kvp = document.location.search.substr(1).split('&');

      var i=kvp.length; var x; while(i--) 
      {
        x = kvp[i].split('=');

        if (x[0]==key)
        {
            x[1] = value;
            kvp[i] = x.join('=');
            break;
        }
      }
      if(i<0) {kvp[kvp.length] = [key,value].join('=');}

      //this will reload the page, it's likely better to store this until finished
      document.location.search = kvp.join('&'); 
  }()
);

无需将任何事情复杂化 ;-)

document.location += '&include_docs=true';

这应该可以解决问题。书签形式:

javascript:(function(){document.location+='&include_docs=true'}());