bookmarklet在url中添加一个参数并重新提交
bookmarklet to add a parameter to the url and resubmit it?
使用bookmarklet可以实现以下功能吗?
- 在URL中添加一个附加参数(include_docs=true)
- 重新提交URL
我有这个,但它在萤火虫上无声地失败了。我还没有尝试过其他浏览器:
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';
这就行了。以bookmarklet形式:
javascript:(function(){document.location+='&include_docs=true'}());
相关文章:
- jqGrid - 将表单数据提交到 jqGrid,并让 jqGrid 使用这些参数获取数据
- 我可以从 Rails 4 中的按钮提交传递参数吗?
- 我可以使用URL路径提交参数吗
- 使用提交按钮参数自动提交表单
- 提交前筛选表单参数
- 提交输入类型=“;图像“;到另一个servlet时,未能返回任何参数
- bookmarklet在url中添加一个参数并重新提交
- 在提交时更改HTML Post参数
- 在表单提交时使用 URL 发送路由参数
- 日期选取器问题,尝试提交除日期值之外的其他参数
- Struts1 处理程序参数在从引导对话框提交时未传递
- Jqgrid 在第二次获取调用后在查询字符串中提交错误的参数
- Spring提交具有双参数
- 表单提交将取消URL查询字符串中的一个参数
- 在提交表单时停止添加URL参数
- PHP/MySQL-数据库数据的复选框,提交2个参数
- 通过Javascript提交带有参数的表单
- 参数没有从带有javascript的提交表单中获取
- jQuery表单提交后的冗余参数
- 使用onclick事件将两个参数提交到同一个servlet中