如何在 Node-Webkit 的同一窗口中打开 URL

How to open URL in the same window in Node-Webkit?

本文关键字:窗口 URL Node-Webkit      更新时间:2023-09-26
var win = gui.Window.open('https://github.com', {
  position: 'center',
  width: 901,
  height: 127
});
这将在新窗口中打开 URL

,但如何在同一主窗口中打开(重定向(URL?

您可以使用普通的 HTML 窗口函数。

window.location.href = 'http://example.com';

只要确保包括

node-remote: 'http://example.com'

在 package.json 中,如果您计划在加载该页面时使用默认的 nodewebkit 功能。