HTML5 Meta Refresh Not Working for Android

I have a web app that needs to run on mobile phones.  I cannot get the page to refresh using the meta tag.   This is the code that I am using:

<meta http-equiv="refresh" content="600">

But the refresh never occurs on Android KitKat's Chrome browser.  Obviously, the app is inactive for some time when the phone sleeps.  But when you awaken the phone and switch to the web page - it does not ever refresh.

Any pointers?
RXGeorgeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
Possibly not supported, alternative is js

setInterval("location.reload(true)", 60000);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RobOwner (Aidellio)Commented:
Test this in your browser as it works for me.  http://jsbin.com/wuhesu/1

I'm running Android 4.3 on 2 devices and the refresh works.  What version of Chrome are you using? (Go to Menu, Help & Feedback when in the browser)

Chrome is not specific to KitKat but is built to run on any version 4.0 and up.
0
RXGeorgeAuthor Commented:
The problem is that when the moment to refresh arrives, if the phone is asleep - it gets skipped until the next one arrives.  

10:00 page loads and refresh set to 10 minutes.  User reads it and puts the phone to "sleep".
10:10 phone is asleep so this refresh will never happen
10:11 user wakes phone and looks at page and its unchanged (no refresh), User reads it and puts back to sleep.
10:20 phone is asleep so this refresh will never happen
10:25 user wakes the phone and looks at page and its unchanged (no refresh). User reads and puts back to sleep.
etc..
etc..
etc..

The user needs to have the phone active at one of the set intervals in order to have the refresh take place.

I would like to see the refresh occur after returning from sleep/power-off assuming at least one interval has passed.  

The demo you gave me seems to work - but because you have such a short interval, i cannot tell if the refresh would occur cumulatively - where the total amount of accumulated real time exceeds the interval.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

GaryCommented:
Well I looked for a reason behind it and couldn't find any.
What I can tell you is that the javascript solution above would fire, all suspended js actions (reload) are executed when the phone wakes.
I guess as the meta refresh is an internal timer then it is reset when the phone sleeps - this is just a guess as I am not sure.
0
RobOwner (Aidellio)Commented:
I would suggest using phonegap to convert your web app to a native application that can run on android.  When sleeping the phone it will suspend the browser and all things that go with it.  With an app you can specify to prevent the phone from sleeping or detect when your app is active again (and will do a refresh).  Is that an option?
0
RobOwner (Aidellio)Commented:
Ok, full points to Gary on this one as he seems to be on the money

When the phone is asleep the browser cannot do anything so it will not be refreshed until the user unlocks the phone.  How long does it take to refresh?  

I've tested and proved that Gary's solution of setInterval will trigger the moment the phone is unlocked.  The timeout is suspended while the phone is asleep but will start again as soon as the phone is unlocked.  It will NOT refresh while the phone is sleeping so I ask again, how long does it take to refresh and is it suitable that it will do it as soon as the phone is unlocked?

http://jsbin.com/bajev/1/edit  <=== tested on my Android phone.
0
RXGeorgeAuthor Commented:
Thanks Rob, Thanks Gary.  

The refresh is quite fast.  Assuming  that the phone does have network access when its awakened... then yes that would be suitable.
0
RXGeorgeAuthor Commented:
Sorry all, i inadvertently awarded the wrong answer... i am having the moderator help me set it to Gary's.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Applications

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.