Skip to content

Instantly share code, notes, and snippets.

@oklai
Created April 3, 2013 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oklai/5298706 to your computer and use it in GitHub Desktop.
Save oklai/5298706 to your computer and use it in GitHub Desktop.
How to not auto focus of the "always-on-top" window.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>How to not auto focus of the "always-on-top" window.</title>
</head>
<body>
test html
<script type="text/javascript">
setTimeout(function () {
var win = require('nw.gui').Window.open("http://www.google.com", {show: false});
//why not user "loaded" event, sometime it doesn't work.
setTimeout(function () {
console.log('blur');
win.show();
win.blur();
//or blur first, show behind
}, 3000);
}, 3000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment