Skip to content

Instantly share code, notes, and snippets.

@dholth
Created February 16, 2012 15:03
Show Gist options
  • Save dholth/1845468 to your computer and use it in GitHub Desktop.
Save dholth/1845468 to your computer and use it in GitHub Desktop.
window.location.reload() / PhoneGap 1.4.0 / Android 3.2.1
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap window.location.reload() on Honeycomb</title>
</head>
<body>
<script>
var reloadMe = function() {
window.localStorage['foobar'] = Number(window.localStorage['foobar'] || 0) + 1;
console.log('reload');
window.location.reload();
// window.location = 'index.html';
}
console.log('set hash to #foobar');
window.location.hash = "#foobar";
window.setTimeout(reloadMe, 2500);
document.write('<h1>' + Number(window.localStorage['foobar']) + '</h1>');
</script>
On Android 3.2.1, <code>window.location.reload</code> does not work when <code>window.location.hash</code> is set?
<h2 id="foobar">foobar</h2>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment