Changed localStorage and sessionsStorage detection to check each time one of them is accessed since they can be enabled/disabled while the page is running.