How to window.open with a toolbar in Google Chrome?

蓝咒 提交于 2019-12-17 09:49:51

问题


The following javascript opens a pop-up in Firefox, Safari, IE, and Google Chrome:

window.open("http://google.com", "foo", "toolbar=yes,location=yes,menubar=yes")

However, in Google Chrome the toolbar (with the usual forward and back buttons, etc.) does not appear on the popped-up window. (Tested on both Windows and Mac.)

How can I fix this? I would like the user to be able to navigate forward and back using the tools with which they are most familiar.


回答1:


Unfortunately 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].

If you just use window.open(url) then it will open a new tab in the same window with the buttons you desire.




回答2:


There is a bug open for Chrome: https://code.google.com/p/chromium/issues/detail?id=82522

It has not received a lot of attention from Google. Vote for it.




回答3:


The only option for Chrome is to not specify a third argument. Chrome ignores the third argument as they are rightly allowed to do according to the HTML 5 specification, but if present the window appears to always open in a floating widow without controls.

If you do not specify a third argument the window that opens will be a new tab and will have all of the features the user needs.

If you do specify a third argument you will get a new floating window with no controls other than the URL display.




回答4:


Updating on current behavior (as of 4/26/2017)

The expected behavior should be a new PopUp Window when size dimensions are passed as arguments to window.open (if toolbar is enabled, then add the toolbar to the PopUp window). If no dimensions are indicated just default to opening a new tab (in this case toolbar enabled is the default). (Btw, this is FF current Behavior (version 54.0a2)) .

Chrome Behavior (Canary 60.0.3079.0)

Opens PopUp Window to indicated dimensions window.open("https://google.com","foo","width=800, height=780")

Opens New Tab (browsers default minimized size, ignores size dimensions) window.open("https://google.com","foo","width=800, height=780,toolbar=1")

FF Behavior

w/Size Dimensions Opens PopUp Window w/o ToolBar (NO toolbar) window.open("https://google.com","foo","width=800, height=780")

Opens PopUp with ToolBar window.open("https://google.com","foo","width=800, height=780, toolbar=1")

w/o dimensions Opens New Tab window.open("https://google.com","foo") window.open("https://google.com","foo", "toolbar=1")




回答5:


I know this is an old post, but the most recent answer is from September, 2013, so I am taking that as a reason to follow up with this answer. Advance apologies if this is not proper etiquette.

https://code.google.com/p/chromium/issues/detail?id=82522

That's the link to the bug over on the Chrome support page.

I am posting it here in the hope that others experiencing this problem will raise attention to this issue, as suggested in a previous answer.

My apologies for posting this comment as a separate answer. I don't have enough karma to do this the right way.



来源:https://stackoverflow.com/questions/2568064/how-to-window-open-with-a-toolbar-in-google-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!