问题描述
- 关于window.open()你们都是如何利用post传参的
- 关于window.open()你们都是如何利用post传参的
解决方案
这没办法用post传参,只能用get
解决方案二:
用表单提交,设置target=""_blank""新窗口打开
window.open和caozhy说的一样只能get
解决方案三:
win = window.open(ctx + ""/page/vulnerableNode/dataBrowse.jsp""alwaysLowered=yes"");
var bodyText = '
';
bodyText = '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
win.document.write(bodyText);
win.document.forms[0].submit(); 解决方案四:
win = window.open(ctx + ""/page/vulnerableNode/dataBrowse.jsp""alwaysLowered=yes"");
var bodyText = '
';
bodyText = '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
bodyText += '';
win.document.write(bodyText);
win.document.forms[0].submit(); 解决方案五:
通过调用form的submit方法不能触发onsubmit事件,代码中只传递了一个参数内容,实际可传递多个。
function openPostWindow(url data name)
{
var tempForm = document.createElement(""form"");
tempForm.id=""tempForm1"";
tempForm.method=""post"";
tempForm.action=url;
tempForm.target=name;
var hideInput = document.createElement(""input"");
hideInput.type=""hidden"";
hideInput.name= ""content""
hideInput.value= data;
tempForm.appendChild(hideInput);
tempForm.attachEvent(""onsubmit""function(){ openWindow(name); });
document.body.appendChild(tempForm);
tempForm.fireEvent(""onsubmit"");
tempForm.submit();
document.body.removeChild(tempForm);
}
function openWindow(name)
{
window.open('about:blank'name'height=400 width=400 top=0 left=0 toolbar=yes menubar=yes scrollbars=yes resizable=yeslocation=yes status=yes');
}