javascript 如何在通过 window.open 或 self.open for Chrome 打开的弹出窗口上显示后退和前进按钮?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10990494/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to show back and forward button on popup opened thru window.open or self.open for Chrome?
提问by M Sach
i am opening the popup window with below code snippet
我正在用下面的代码片段打开弹出窗口
self.open('myJSPPage','ServicePopUp','height=600,width=800,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes');
Once the window opens i do not see any back button or forward button on popup. I just see title then address bar under it and then myJSPPage under address bar. I am not getting how to show back and forward button on popup?
窗口打开后,我在弹出窗口中看不到任何后退按钮或前进按钮。我只看到标题,然后在它下面的地址栏,然后在地址栏下看到 myJSPPage。我不知道如何在弹出窗口中显示后退和前进按钮?
Edit:-i am using google crome. Looks like above code working on IE
编辑:-我正在使用谷歌 crome。看起来像上面的代码在 IE 上工作
采纳答案by shareef
i tested this example and it gives me forward and back button on FF try this
我测试了这个例子,它给了我在 FF 上的前进和后退按钮 试试这个
<!-- Codes by Quackit.com -->
<script type="text/javascript">
// Popup window code
function newPopup(url) {
popupWindow = window.open(
url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>
<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>
jsfiddle live demo for your code an mine it gave me buttons on FF test
你的代码的 jsfiddle 现场演示它给了我 FF 测试的按钮
update:yes you are right chrome does not give the result expected
更新:是的,你是对的 chrome 没有给出预期的结果
possible duplicate
可能重复
another asked question in stack over flowUnfortunately Chrome only supports a small set of window features when using window.open. If you believe that this is a bug or an issue you can file it at http://crbug.com.
堆栈溢出中的另一个问题不幸的是,Chrome 在使用 window.open 时仅支持一小组窗口功能。如果您认为这是一个错误或问题,您可以在http://crbug.com 上提交。
If you just use window.open(url) then it will open a new tab in the same window with the buttons you desire.
如果你只使用 window.open(url) 那么它会在同一个窗口中打开一个带有你想要的按钮的新标签。