I’m writing a mobile website and have a splash screen display briefly before the site loads.
I am using the following code in my index.php file to redirect to the splash screen
session_start();
if(!isset($_SESSION['splash'])){
$_SESSION['splash']=true;
header('Location: splash.html');
}
//Do normal index.php
The splash screen redirects back to index.php after 1 second which this time skips the splash screen section and loads the site normally.
This all works really well until someone disables cookies!
In this case, the session variable ‘splash’ never gets set so you just get an endless loop displaying the splash screen again and again and again….
What’s the best way to deal with this situation?
You can make PHP pass the session ID as GET variable instead of storing it in a cookie. See here for info on how to do it.