【问题标题】:How to open URL in the same window in Node-Webkit?如何在 Node-Webkit 的同一窗口中打开 URL?
【发布时间】:2015-03-20 19:37:56
【问题描述】:
var win = gui.Window.open('https://github.com', {
  position: 'center',
  width: 901,
  height: 127
});

这将在新窗口中打开 URL,但是如何在同一个主窗口中打开(重定向)该 URL?

【问题讨论】:

  • 我知道我可以做到这一点:。 /nw path_to_app_dir --url="website-url" 但需要一种在应用程序运行时重定向的方法... :( 可能吗?

标签: javascript node-webkit


【解决方案1】:

您可以使用普通的 HTML 窗口功能。

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

一定要包含

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

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

【讨论】:

  • tx 为答案,但我只知道运行时的网站,因此无法将其添加到 package.json,所以使用 iFrame 的唯一选项是 :( ?
猜你喜欢
  • 2013-11-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-10
  • 2013-12-10
  • 2021-05-11
  • 2016-02-22
相关资源
最近更新 更多