Skip to content
Could not find version "repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches "

Show window after page is ready

zcbenz edited this page · 1 revision
Clone this wiki locally
Clone in Desktop

This example needs node-webkit >= v0.3.0

Normally when node-webkit loads an app, it would: 1. show the browser; 2. unzip your app; 3. create renderer process; 4. initialize WebKit; 5. finally open your app. This progress would take some time, and your user may see the empty browser becoming a full loaded app.

To make your app seem to start smoothly, you should show the main window after everything is ready. There are some tips to achieve this.

First you need to specify "show": false in the package.json, so node-webkit will not show the window on startup:

{
  "window": {
    "show": false
  }
}

Then after everything is fully loaded, you can use the Window API to show your app's window:

<script>
var gui = require('nw.gui');

onload = function() {
  gui.Window.get().show();
}
</script>
Something went wrong with that request. Please try again.