Javascript Window.Open: Chrome 不支持工具栏,back/forth 导航按钮

Javascript Window.Open: Chrome is not honoring Toolbars , back/forth navigation buttons

我有 Chrome 2020 年的最新版本 86.0.4240.111。 当我在 Typescript Angular 中 运行 一个 Window.Open 命令时,它不支持工具栏。我需要 back/forth 导航按钮。我怎样才能让 Chrome 关注这个?

const strWindowFeatures = `location=yes,height=${screen.height},width=${screen.width},fullscreen=yes,toolbar=yes,scrollbars=yes,resizable=yes`;
var newWindow = window.open('http://www.cnn.com', 'test', strWindowFeatures);
newWindow.moveTo(0, 0);  
 

上面没有来回箭头

根据MDN window.open#Toolbar_and_UI_parts_features

In modern browsers (Firefox 76 or newer, Google Chrome, Safari, Chromium Edge), the following features are just a condition for whether to open popup or not. See popup condition section.

并且根据popup condition

Most modern browsers (listed below) don't allow web content to control the visibility of UI parts separately.

  • Firefox 76 or newer
  • Google Chrome
  • Safari
  • Chromium Edge

UI-related items of windowFeatures are used as a condition to whether opening a popup or a new tab, or a new window, and UI parts visibility of each of them is fixed.

The condition is implementation-depepdent and not guaranteed to be stable.

所以,我猜你正在打开一个弹出窗口,因此,Google Chrome 不允许在导航之外显示其他 chrome 的元素酒吧。这可能是为了区分弹出窗口和新选项卡。

将这些选项传递给 window.open 将创建一个弹出窗口而不是普通选项卡,但如果不是出于上述原因,其中一些似乎并没有真正使用。

  • 菜单栏
  • 工具栏
  • 位置
  • 状态
  • 可调整大小
  • 滚动条

希望这对你有用。