How to navigate to new page in nw.js -


this simple question can't life of me find answer online. i'm using nw.js , specify main html file in package file. however, how can navigate in same main window different html page? window object doesn't seem have way this. has open() function opens new window isn't want.

i pretty new nw.js, have found 1 solution. believe reason window object not work because of javascript context. nw.js has node context , webkit context. (more can read here: https://github.com/nwjs/nw.js/wiki/differences-of-javascript-contexts). however, solved similar problem making separate js file setting button change page.

index.js:

document.getelementbyid("button").onclick = function(){     window.location.href = './otherpage.html'; } 

make sure require method not used in same js file change context.

then load html file.

index.html:

<script src="./path_to/index.js"></script> 

hope helps. feel free ask questions or elaboration. try best help.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -