Reload page when user clicks back on iPhone

Hi all.

I have a webpage where the end user enters some information and then clicks the "Lookup" button that will take them to a "Results.php" page. I'm having an issue when they click back on the iPhone, it keeps what was previously entered. Instead I want it to reload the page, I've tried using location.reload(true) on the <body unload> section, but that doesn't work on my iPhone, but it does work if I'm using Chrome etc.

What can I do?

Thank you in advance.

<head>
  <title>Web App</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="style.css" type="text/css" />
  <link href="iphone-icon1.png" rel="apple-touch-icon">
<script>
function reloadPage()
{
location.reload(true)
}
</script>
</head>
<body onunload="reloadPage()">

Open in new window

Sim1980Asked:
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.

joinaunionCommented:
Is this what your trying?
(EDIT @tagit TA) {LINK DELETED TO COMPETING SITE}
0
Sim1980Author Commented:
Thank you for your suggestion. That article didn't work but I was able to find some code that did it.

 
<script>

function ReloadPage() {
if ((/iphone|ipod|ipad.*os 5/gi).test(navigator.appVersion)) {
window.onpageshow = function(evt) {
if (evt.persisted) {
document.body.style.display = "none";
location.reload();
}
};
}
}	
</script>
</head>
<body onload="ReloadPage()">

Open in new window

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
Sim1980Author Commented:
I found my own solution.
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
JavaScript

From novice to tech pro — start learning today.