简体   繁体   English

Target = _blank在mozilla和IE中不起作用

[英]Target=_blank don't work in mozilla and IE

I have a form for submitting and posting result in new tab , my code working fine in Chrome, but when i open my page in Mozilla or IE , it doesn't work , and new tab will not Open. 我有一个用于在新标签页中提交和发布结果的表单,我的代码在Chrome中可以正常工作,但是当我在Mozilla或IE中打开页面时,它不起作用,并且新标签页不会打开。

all i want is to open form submitting in new tab , in common browsers (mozilla,chrome,IE) 我想要的就是在常见浏览器(mozilla,chrome,IE)中的新标签页中打开提交表单的功能

Here is my code: 这是我的代码:

<form enctype="application/x-www-form-urlencoded" action method="post" target="_blank" id="test1">
<input type="text" name="txtUserPrice" id="txtUserPrice" />
        <input type="submit" name="btnSubmitForm" value="Buy" />
</form>

i think my problem come from target="_blank" , Because in chrome, it open new tab. 我认为我的问题来自target="_blank" ,因为在chrome中,它会打开新标签页。 But other browsers (Mozilla and IE) doesn't. 但是其他浏览器(Mozilla和IE)则没有。

How can i fix this? 我怎样才能解决这个问题?

One more question: 还有一个问题:

This problem , cause for different browser rendering or code parsing? 这个问题,导致不同的浏览器渲染或代码解析?

This code perfectly working on my mozilla & IE. 这段代码可以在我的mozilla和IE上完美运行。 I think clients need to update the browsers ... 我认为客户需要更新浏览器...

this is a Known Bug Microsoft Internet Explorer 这是一个已知的错误Microsoft Internet Explorer

Some versions of MSIE have a bug which renders anchors using "_blank" inoperative. MSIE的某些版本存在一个错误,该错误使“ _blank”无法使用锚。 See "Open In New Window" Does Not Work in Internet Explorer for the patch. 有关修补程序,请参阅“在新窗口中打开”在Internet Explorer中不起作用。

Read more at: 阅读更多信息:

http://answers.microsoft.com/en-us/ie/forum/ie9-windows_7/intermittent-problems-with-targetblank-in-ie-9/c7e937be-7400-41e9-bf03-14474fbc1832?auth=1 http://answers.microsoft.com/en-us/ie/forum/ie9-windows_7/intermittent-problems-with-targetblank-in-ie-9/c7e937be-7400-41e9-bf03-14474fbc1832?auth=1

Please check by replacing _blank with blank 请检查以_blank替换为blank

<form enctype="application/x-www-form-urlencoded" action method="post" target="blank" id="test1">

Check jsfiddle 检查jsfiddle

尝试将target替换为onclick

onclick="window.open('example.php', 'newwindow', 'width=800, height=600'); return false;" 

Try, adding formtarget attribute to submit button : 尝试将formtarget属性添加到formtarget按钮:

<form enctype="application/x-www-form-urlencoded" action method="post" target="_blank" id="test1">
    <input type="text" name="txtUserPrice" id="txtUserPrice" />
    <input type="submit" formtarget="_blank" name="btnSubmitForm" value="Buy" />
</form>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM