Windows 7 x64、nwjs 0.19.4
トレイへの最小化は window.location.href を設定しなくても正常に動作しますが、nwjs を設定するとトレイに最小化されません。
リクエストごとに改訂されたコード:
index.html
<html>
<body>
<div></div>
<script>
// Load library
var gui = require('nw.gui');
// Reference to window and tray
var win = gui.Window.get();
var tray;
onload = function () {
window.location.href = "http://iheartradio.com"
};
// Get the minimize event
win.on('minimize', function () {
// Hide window
win.hide();
var tray = new nw.Tray({
title: 'Web Music Player',
icon: 'img/music.png'
});
// Show window and remove tray when clicked
tray.on('click', function () {
win.show();
this.remove();
tray = null;
});
});
</script>
</body>
</html>
パッケージ.json
{
"name": "webmusicplayer",
"version": "0.1.0",
"main": "index.html",
"single-instance": true,
"window": {
"title": "webmusicplayer",
"min_width": 1200,
"min_height": 600
},
"webkit": {
"plugin": true
},
"chromium-args": "--load-plugin=ffmpegsumo.dll --child-clean-exit --disable-direct-composition --allow-running-insecure-content --no-proxy-server --enable-video-player-chromecast-support"
}