I am including the script that I have written, please tell me if something
is wrong. I haven't installed yet, before that I have read up how to test
it.
// ==UserScript==
// @key value
// @name : Reload the page if there is any change in Ip address of the
system
// namespace
// @Description:
// @include http://*
// @include file://*
// ==/UserScript==
window.setInterval("checkIpChange()",2000); // Call the function every 2
seconds
var protocol= location.protocol;
var pattern= file:
function checkIpChange()
{
protocol= location.protocol;
if( protocol.match(pattern)
{
window.location.reload();
}
else
{
GM_xmlhttpRequest(
{
method: 'GET',
url: 'http://localhost/readValue.txt', // file which
contains the value
headers:
{
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Accept': 'application/atom+xml,application/xml,text/xml',
},
onload: function(responseDetails) //My text file entry would be
either '0' or '1'
{
/*alert('Request for Atom feed returned ' +
responseDetails.status + ' ' + responseDetails.statusText + '\n\n' +
'Feed data:\n' + responseDetails.responseText);*/
change= responseDetails.responseText ;
if(change==1)
{
window.location.reload();
}
else
{
//Do Nothing
}
}
}
);
}
}
Thanks
Jyoti
On Wed, May 26, 2010 at 12:11 PM, cc <[email protected]> wrote:
> Give it a go, it should work. (Also, in general: it's often faster just to
> try a naive test, and if it works, you're golden; asking the group takes
> longer and more of our time.)
>
>
> On 2010-05-25 23:35, jyothi panidarapu wrote:
>
> I have a small doubt.
> if I load the text file on my local web server, can I read the value of it
> using GM_xmlhttprequest() ?
> http://localhost/myfile.txt
>
> On Wed, May 26, 2010 at 11:28 AM, esquifit <[email protected]>wrote:
>
>> Here you can find some inspiration:
>>
>>
>> http://groups.google.com/group/greasemonkey-users/browse_thread/thread/21ad5af3c7cc4b00
>>
>> --
>> 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.
> Healthcare.com : Request Health Insurance Quotes Leading Health Insurance
> Providers
> http://click.lavabit.com/?r=MTYyNjA5
>
>
> --
> cc | pseudonymous | <http://carlclark.mp/> <http://carlclark.mp/>
>
>
> --
> ~ A clean house is a sign of a misspent life. ~
> http://tagzilla.mozdev.orgv0.066
>
> --
> 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.