You mean to say I should add the file location also to the script (in GM to apply this script to this location also). If so unless I open the location, is the script going to work for that file url?
On Sat, May 22, 2010 at 1:31 AM, esquifit <[email protected]> wrote: > On Fri, May 21, 2010 at 8:30 PM, jyothi panidarapu > <[email protected]> wrote: > > Yeah, I can give you details. I actually want to reload my web page if > there > > is any change in my system IP address. The existing scripts are using > > whatismyip.com to get the ip. My problem here is, in my institution both > > wired and wireless uses the same proxy. So when you query that site for > ip > > address, it shows the same every time. Because outsiders can only see one > > ip. > > > > So I what I thought is updating this information to a local file and if > > somehow javascript can periodically read it, then I can achieve my > purpose. > > Just a little brainstorming: > > One way would be detecting the ip via java. There is a recent post > addressing this question. > > Another way would be trying to load resources from the different > networks and testing timeouts or something like that. The onload and > onerror events of the IMG object are sometime used for this. > > If you insist upon using a file, there seems to be a way to accomplish > what you want with a Greasemonkey script, along the following lines: > > 1) the script should run for the pages you want AND in addition for > the file:/// url of the file > 2) If (location.href begins with "file:") > read the page content (which consist exactly of the ip address, > or a '0' or '1', or whatever) > store this value into a preference via GM_setValue > trigger a delayed reload via setTimeout. > else > call a function that > a) reads the value of the above preference via GM_getValue > b) if the preference value is 0 do nothing > c) if the preference value is 1, reload page, or make a > redirection to the mobile url, or whatever > d) self-invoke the function with a delay via setTimeout. > > -- > You received this message because you are subscribed to the Google Groups > "greasemonkey-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<greasemonkey-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/greasemonkey-users?hl=en. > > -- - Jyothi M.Tech,CSE IITMadras -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
