Open window and get content "h2" tag.

0 views
Skip to first unread message

Алексей Холявко

unread,
Aug 22, 2013, 8:35:28 AM8/22/13
to node-...@googlegroups.com
I whant to open window with some url and for example get content of first "h2" tag. But in page console i recive an error Uncaught ReferenceError: require is not defined ind I'm not sure of the code
 
<html><body>
  <script >
      var gui = require('nw.gui');
      var win = gui.Window.get();
      var ocean = gui.Window.open('http://en.wikipedia.org/wiki/Oceania');
      ocean.on('loaded', function() {
        var header = ocean.document.getElementById("bodyContent").getElementsByTagName("h2")[0].textContent;
        console.log(header);
      });        
  </script>
</body></html>
Message has been deleted

Алексей Холявко

unread,
Aug 22, 2013, 8:51:22 AM8/22/13
to node-...@googlegroups.com
{
  "name": "nw-demo",
  "main": "index.html",
  "webkit": {
    "plugin": true
  }
}
add package.json and create app.zip
/nw$ zip app.nw index.html package.json

 
Reply all
Reply to author
Forward
0 new messages