I've got a working deviantArt webapp, the message counts are working, although they never change. I'd like to refresh the webpage they're on so we get new totals. Is there any way of doing that?
Asked
Active
Viewed 463 times
1 Answers
1
I don't think reloading a webpage without direct command from user is a good idea. Imagine yourself reading something then suddenly browser reloads the page.
Better approach would be getting massage count from API or something, or requesting another page once in a while (via ajax) and fetching message-count and others from there.
update:
because webapp userscript is just normal javascript attached to special pages from the browser, you can request pages via ajax as discussed here. Obviously you can skip the parts for IE6 and 7 in the code.
I'm not sure if you can use jQuery or not because your script might be loaded before everything else and it is not used in tutorials. I don't think depending on jQuery would be good idea anyway.
-
I agree, please detail how an ajax command might work in the context of the javascript webapp code. – Martin Owens -doctormo- Jan 04 '13 at 13:22
-
Updated the answer with some details. – Arash Badie Modiri Jan 04 '13 at 17:17