[英]bookmarklet to add a parameter to the url and resubmit it?
書簽是否可以實現以下功能?
我有這個但它在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'}());
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.