Listen for url changes on opened windows?
The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From:
scottgmead... @gmail.com
Date: Tue, 23 Oct 2012 16:10:52 -0700 (PDT)
Local: Tues, Oct 23 2012 7:10 pm
Subject: Listen for url changes on opened windows?
Hey all, Forgive me if I've missed something obvious here (I'm coming from the front end dev world, so am a little out of my element), but I'm wondering if there's a way I can listen for url changes on an opened window? I've tried:
openedWindow.addEventListener("load",function() { alert(openedWindow.location.href);
});
But it fails to report the location beyond the initial page load. Have also tried polling openedWindow (not elegant I know), but it reports 'swappedout://' as the href as soon as I change the url in the nw address bar and fails thereafter. I suppose I'm looking for an extension to the window api - something like the tabs.onUpdated api for Chrome Extensions<https://developer.chrome.com/extensions/tabs.html#event-onUpdated > .
Thoughts?
Cheers, -Scott
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Zhao Cheng <zcb... @gmail.com>
Date: Thu, 25 Oct 2012 14:10:24 +0800
Local: Thurs, Oct 25 2012 2:10 am
Subject: Re: [node-webkit] Listen for url changes on opened windows?
After the window has changed its URL, its javascript context will be
completely lost. Event you can listen to the url change event, you
will not be able to get new window's `window` object, which means you
can do nothing with the new window. This limitation is determined by
browser nature.
So you should never refresh the whole page, you need to use ajax to
refresh only part of your page.
On Wed, Oct 24, 2012 at 7:10 AM, <scottgmead
... @gmail.com> wrote:
> Hey all,
> Forgive me if I've missed something obvious here (I'm coming from the front
> end dev world, so am a little out of my element), but I'm wondering if
> there's a way I can listen for url changes on an opened window? I've tried:
> openedWindow.addEventListener("load",function() {
> alert(openedWindow.location.href);
> });
> But it fails to report the location beyond the initial page load. Have also
> tried polling openedWindow (not elegant I know), but it reports
> 'swappedout://' as the href as soon as I change the url in the nw address
> bar and fails thereafter.
> I suppose I'm looking for an extension to the window api - something like
> the tabs.onUpdated api for Chrome Extensions.
> Thoughts?
> Cheers,
> -Scott
-- Cheng
Intel Open Source Technology Center
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Roger <wen... @gmail.com>
Date: Thu, 25 Oct 2012 14:12:21 +0800
Local: Thurs, Oct 25 2012 2:12 am
Subject: Re: [node-webkit] Listen for url changes on opened windows?
On Thu, Oct 25, 2012 at 2:10 PM, Zhao Cheng <zcb
... @gmail.com> wrote:
> After the window has changed its URL, its javascript context will be
> completely lost.
Right. But the Node's context would not? So the code in Node context can do
this job.
Roger
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Roger <wen... @gmail.com>
Date: Thu, 25 Oct 2012 16:56:57 +0800
Local: Thurs, Oct 25 2012 4:56 am
Subject: Re: [node-webkit] Listen for url changes on opened windows?
On Thu, Oct 25, 2012 at 2:12 PM, Roger <wen
... @gmail.com> wrote:
> On Thu, Oct 25, 2012 at 2:10 PM, Zhao Cheng <zcb
... @gmail.com> wrote:
>> After the window has changed its URL, its javascript context will be
>> completely lost.
> Right. But the Node's context would not? So the code in Node context can
> do this job.
And that's why we need to fix #36 [1], which should be the only way to
define functions in Node context.
[1] https://github.com/rogerwang/node-webkit/issues/36
Roger
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
scottgmead... @gmail.com
Date: Mon, 29 Oct 2012 02:51:10 -0700 (PDT)
Local: Mon, Oct 29 2012 5:51 am
Subject: Re: [node-webkit] Listen for url changes on opened windows?
Now that the #36 fix is in, I'm curious about how I would do this properly. Have tried the following code window api code in app.js which is defined as node-main in the manifest.
<code> var gui = require('nw.gui'); var newWindow = gui.Window.get(
window.open('http://google.ca');
) </code>
This seems to throw an error (the nw ui just goes grey). Is this a bug or am I doing something wrong?
On Thursday, October 25, 2012 4:56:58 AM UTC-4, Roger Wang wrote:
> On Thu, Oct 25, 2012 at 2:12 PM, Roger <wen... @gmail.com <javascript:>>wrote:
>> On Thu, Oct 25, 2012 at 2:10 PM, Zhao Cheng <zcb... @gmail.com<javascript:> >> > wrote:
>>> After the window has changed its URL, its javascript context will be >>> completely lost.
>> Right. But the Node's context would not? So the code in Node context can >> do this job.
> And that's why we need to fix #36 [1], which should be the only way to > define functions in Node context.
> [1] https://github.com/rogerwang/node-webkit/issues/36
> Roger
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Roger WANG <roger.w... @intel.com>
Date: Mon, 29 Oct 2012 22:17:58 +0800
Local: Mon, Oct 29 2012 10:17 am
Subject: Re: [node-webkit] Listen for url changes on opened windows?
<scottgmead
... @gmail.com> writes:
> Now that the #36 fix is in, I'm curious about how I would do this
> properly.
At least in my testing the fix didn't work. Will re-open the issue and
follow up on this.
> Have tried the following code window api code in app.js which is defined as
> node-main in the manifest.
> <code>
> var gui = require('nw.gui');
> var newWindow = gui.Window.get(
> window.open('http://google.ca');
> )
> </code>
> This seems to throw an error (the nw ui just goes grey). Is this a bug or > am I doing something wrong?
Even after #36 works, 'nw.gui' and windows objects cannot be opened
here (which should be another item on our TODO). A callback function should be defined here and then referred from
WebKit context (e.g. from your index.html)
-- Roger WANG Intel Open Source Technology Center
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
scottgmead... @gmail.com
Date: Mon, 29 Oct 2012 17:02:58 -0700 (PDT)
Local: Mon, Oct 29 2012 8:02 pm
Subject: Re: [node-webkit] Listen for url changes on opened windows?
Opened issue #128 <https://github.com/rogerwang/node-webkit/issues/128 >. Roger, thanks for the quick reply and your continued hard work on node-webkit.
Let me give some context to my question here... I'm working on an application that will use node-webkit as a browser for the web at large with some added node functionality in the background, so access to index.html is a bit tricky to say the least.
Is this kind of project 'in scope' for nw?
Cheers! -Scott
On Monday, October 29, 2012 10:18:03 AM UTC-4, Roger WANG wrote:
> <scottg... @gmail.com <javascript:>> writes:
> > Now that the #36 fix is in, I'm curious about how I would do this > > properly.
> At least in my testing the fix didn't work. Will re-open the issue and > follow up on this.
> > Have tried the following code window api code in app.js which is defined > as > > node-main in the manifest.
> > <code> > > var gui = require('nw.gui'); > > var newWindow = gui.Window.get(
> > window.open('http://google.ca');
> > ) > > </code>
> > This seems to throw an error (the nw ui just goes grey). Is this a bug > or > > am I doing something wrong?
> Even after #36 works, 'nw.gui' and windows objects cannot be opened > here (which should be another item on our TODO).
> A callback function should be defined here and then referred from > WebKit context (e.g. from your index.html)
> -- > Roger WANG Intel Open Source Technology Center
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Roger <wen... @gmail.com>
Date: Tue, 30 Oct 2012 08:08:07 +0800
Local: Mon, Oct 29 2012 8:08 pm
Subject: Re: [node-webkit] Listen for url changes on opened windows?
Sure it is in our scope.
Roger
-------- Original Message --------
From: scottgmead
... @gmail.com
Sent: Tue Oct 30 08:02:58 格林尼治标准时间+0800 2012
To: node-webkit@googlegroups.com
Cc: Zhao Cheng <zcb... @gmail.com>
Subject: Re: [node-webkit] Listen for url changes on opened windows?
Opened issue #128 <https://github.com/rogerwang/node-webkit/issues/128 >.
Roger, thanks for the quick reply and your continued hard work on node-webkit.
Let me give some context to my question here... I'm working on an application that will use node-webkit as a browser for the web at large with some added node functionality in the background, so access to index.html is a bit tricky to say the least.
Is this kind of project 'in scope' for nw?
Cheers!
-Scott
On Monday, October 29, 2012 10:18:03 AM UTC-4, Roger WANG wrote:
> <scottg... @gmail.com <javascript:>> writes:
> > Now that the #36 fix is in, I'm curious about how I would do this > > properly.
> At least in my testing the fix didn't work. Will re-open the issue and > follow up on this.
> > Have tried the following code window api code in app.js which is defined > as > > node-main in the manifest.
> > <code> > > var gui = require('nw.gui'); > > var newWindow = gui.Window.get(
> > window.open('http://google.ca');
> > ) > > </code>
> > This seems to throw an error (the nw ui just goes grey). Is this a bug > or > > am I doing something wrong?
> Even after #36 works, 'nw.gui' and windows objects cannot be opened > here (which should be another item on our TODO).
> A callback function should be defined here and then referred from > WebKit context (e.g. from your index.html)
> -- > Roger WANG Intel Open Source Technology Center
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Roger WANG <roger.w... @intel.com>
Date: Mon, 14 Jan 2013 23:38:10 +0800
Local: Mon, Jan 14 2013 10:38 am
Subject: Re: [node-webkit] Listen for url changes on opened windows?
Roger WANG <roger.w
... @intel.com> writes:
> <scottgmead
... @gmail.com> writes:
>> Now that the #36 fix is in, I'm curious about how I would do this
>> properly.
> At least in my testing the fix didn't work. Will re-open the issue and
> follow up on this.
Just had a try and it's working with 'loaded' event on the Window
object:
https://github.com/rogerwang/node-webkit/wiki/Window
You can use it from Node context:
var gui = window.require('nw.gui');
gui.Window.get(win).on('loaded', function() {
window.console.log(window.location.href); });
-- Roger WANG Intel Open Source Technology Center
You must
Sign in before you can post messages.
You do not have the permission required to post.