From 4d0edc8188f72d5aea187cc65e62af587cefe884 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Tue, 15 Dec 2015 13:24:30 +0100 Subject: fix for safari incognito mode --- index.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 087a099..97934e5 100644 --- a/index.html +++ b/index.html @@ -31,7 +31,10 @@ socket.on("roomgameturn",roomgameturn); socket.on("roomgameplace",roomgameplace); socket.on("roomgamewin",roomgamewin); -if(location.hostname=="localhost"&&Math.random()<.25)localStorage.setItem("nickname","aaa"); +if(location.hostname=="localhost"&&Math.random()<.25){ + try{localStorage.setItem("nickname","aaa");} + catch(e){} +} if(localStorage.getItem("nickname"))socket.emit("setnick",localStorage.getItem("nickname")); else socket.emit("me",updateme); @@ -40,7 +43,8 @@ socket.emit("userlist",updateuserlist); function updateme(_me){ me=_me; document.getElementById("nickname").innerHTML=me[1]; - localStorage.setItem("nickname",me[1]); + try{localStorage.setItem("nickname",me[1]);} + catch(e){} } function updateuserlist(_ul){ -- cgit v1.2.3