Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
I agree, please detail how an ajax command might work in the context of the javascript webapp code. –  Martin Owens -doctormo- Jan 4 '13 at 13:22
    
Updated the answer with some details. –  Arash Badie Modiri Jan 4 '13 at 17:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.