Code for handling sessions in safari