Created
October 19, 2011 02:56
-
-
Save takimo/1297376 to your computer and use it in GitHub Desktop.
Test iOS5 Private Browsing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> | |
| <title>Test iOS5 Private Mode Browsing</title> | |
| <script src="private-mode-test.js"></script> | |
| <style> | |
| article, aside, dialog, figure, footer, header, | |
| hgroup, menu, nav, section { display: block; } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>Test iOS5 Private Mode Browsing</h1> | |
| <h5>window.localStorage</h5> | |
| code | |
| <code><pre> | |
| try{ | |
| if(window.localStorage){ | |
| alert("exist"); | |
| }else{ | |
| alert("not exist"); | |
| } | |
| }catch(error){ | |
| alert("error"); | |
| } | |
| </pre></code> | |
| <input type="button" onClick="test1()" value="test"/> | |
| <h5>window.localStorage.getItem</h5> | |
| code | |
| <code><pre> | |
| try{ | |
| if(window.localStorage.getItem){ | |
| alert("exist"); | |
| }else{ | |
| alert("not exist"); | |
| } | |
| }catch(error){ | |
| alert("error"); | |
| } | |
| </pre></code> | |
| <input type="button" onClick="test2()" value="test"/> | |
| <h5>window.localStorage.setItem</h5> | |
| code | |
| <code><pre> | |
| try{ | |
| if(window.localStorage.getItem){ | |
| alert("exist"); | |
| }else{ | |
| alert("not exist"); | |
| } | |
| }catch(error){ | |
| alert("error"); | |
| } | |
| </pre></code> | |
| <input type="button" onClick="test3()" value="test"/> | |
| <h5>get item</h5> | |
| code | |
| <code><pre> | |
| try{ | |
| localStorage.getItem("sample") | |
| alert("success"); | |
| }catch(error){ | |
| alert("error"); | |
| } | |
| </pre></code> | |
| <input type="button" onClick="test4()" value="test"/> | |
| <h5>set item</h5> | |
| code | |
| <code><pre> | |
| try{ | |
| if(localStorage.setItem("sample", "value")) | |
| alert("success"); | |
| }else{ | |
| alert("failed"); | |
| } | |
| }catch(error){ | |
| alert("error"); | |
| } | |
| </pre></code> | |
| <input type="button" onClick="test5()" value="test"/> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function test1(){ | |
| try{ | |
| if(window.localStorage){ | |
| alert("exist"); | |
| }else{ | |
| alert("not exist"); | |
| } | |
| }catch(error){ | |
| alert("error"); | |
| } | |
| } | |
| function test2(){ | |
| try{ | |
| if(window.localStorage.getItem){ | |
| alert("exist"); | |
| }else{ | |
| alert("not exist"); | |
| } | |
| }catch(error){ | |
| alert("error"); | |
| } | |
| } | |
| function test3(){ | |
| try{ | |
| if(window.localStorage.setItem){ | |
| alert("exist"); | |
| }else{ | |
| alert("not exist"); | |
| } | |
| }catch(error){ | |
| alert("error"); | |
| } | |
| } | |
| function test4(){ | |
| try{ | |
| localStorage.getItem("sample"); | |
| alert("success"); | |
| }catch(error){ | |
| alert("error"); | |
| } | |
| } | |
| function test5(){ | |
| try{ | |
| localStorage.setItem("sample", "value") | |
| alert("success"); | |
| }catch(error){ | |
| alert("error"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment