Is this "correct" sessionstorage?

In my app, I have a splash screen showing on launch according to code on index.html. However, to prevent it from launching every time the Back button takes one to the index.html page, I set a number in sessionstorage so that if the number is there, it won’t launch again as long as it’s still in memory. This works fine.

However, I am having it check a value in sessionstorage before a value has been written, so I’m not sure this is “correct” syntax, even though it works. Is there a correct way to do this?

<script>
function onBodyLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}

function onDeviceReady() {
// Check session storage to see if splash screen already appeared
 countLaunchImage();
}
function countLaunchImage() {
/* If the value is 0 then it's already displayed. If > 0, then t hasn't yet shown and should display. */
 var name = sessionStorage.getItem("count");
 if (name > 0) { showLaunchImage(); }
}
function showLaunchImage() {
// Show splash screen
navigator.splashscreen.show();
// Set value to 0 after it appears
sessionStorage.setItem("count", "0");
// countLaunchImage() should now see a 0 and not launch next time.
}
setTimeout(function() {
 navigator.splashscreen.hide();
}, 1000);
</script> 

It is correct. getItem will return null if the key doesn’t exist, and null > 0 evaluates to false, so it does what you want (or does it?).

Here’s the spec for getItem: http://www.whatwg.org/specs/web-apps/current-work/multipage/webstorage.html#dom-storage-getitem

Thank you! I appreciate the answer.

Interesting that this was moved to JS. I thought it was a spec of HTML5: https://code.google.com/p/sessionstorage/

Session storage has a JavaScript API, hence the JS forum.
Thank you for taking the time to think about where to post though. It is appreciated.