|
1 <!DOCTYPE html> |
|
2 <html lang="en"> |
|
3 <head> |
|
4 <meta charset="utf-8"> |
|
5 <title>browser_sessionStorage.html</title> |
|
6 </head> |
|
7 <body> |
|
8 <script type="text/javascript;version=1.8"> |
|
9 let isOuter = window == window.top; |
|
10 let args = window.location.search.slice(1).split("&"); |
|
11 let rand = args[0]; |
|
12 |
|
13 if (isOuter) { |
|
14 let iframe = document.createElement("iframe"); |
|
15 let isSecure = args.indexOf("secure") > -1; |
|
16 let scheme = isSecure ? "https" : "http"; |
|
17 iframe.setAttribute("src", scheme + "://example.com" + location.pathname + "?" + rand); |
|
18 document.body.appendChild(iframe); |
|
19 } |
|
20 |
|
21 if (sessionStorage.length === 0) { |
|
22 sessionStorage.test = (isOuter ? "outer" : "inner") + "-value-" + rand; |
|
23 } |
|
24 </script> |
|
25 </body> |
|
26 </html> |