I am trying to develop a mobile app that monitors a web page(remote and not administered by me), such that whenever the content(body tag) of that page changes, my app come to know of that change and notifies the user.
I want to develop this mobile app using phonegap, jquery/javascript but can’t use any server side language. After a lot of research, i thought of using YQL(Yahoo query language). It takes the url of the web page and returns its html in json format. I then stringify the json and calculate its unique hashcode using javascript and save the hashcode. I keep repeating these steps after every 5 minutes and keep comparing the hashcodes. If there is any change in hashcode, i get to know that the content of the web page is changed.
Although it is working good, but I was wondering if there is any alternative way of doing it because it seems very inefficient to grab entire page to a mobile and then store its hashcode? Any way which is more efficient?
Thanks
Depends on the webpage but in practice you can make a
HEADrequest instead of aGETrequest then check theLast-Modifiedheader if present. Though, then you’d have to make a normalGETrequest to get the body contents if theLast-Modifieddate has changed