-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathspotify-storage.html
More file actions
51 lines (45 loc) · 1.46 KB
/
spotify-storage.html
File metadata and controls
51 lines (45 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<html>
<body>
<p id="dummy"></p>
<script>
document.domain = 'websnapins.com'; // should be top-level domain e.g. spotify.com
function storeSessionData(key, data) {
if(data){
sessionStorage.setItem(key, data);
}else{
removeSessionData(key);
}
}
function getSessionData(key, data) {
return sessionStorage.getItem(key);
}
function removeSessionData(key) {
return sessionStorage.removeItem(key);
}
function createCookie(name,value,minutes) {
var expires = "";
if (minutes) {
var date = new Date();
date.setTime(date.getTime() + (minutes*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
var targetorigin = 'http://' + parent.location.hostname;
parent.postMessage("storage_iframe_initialized", targetorigin);
</script>
</body>
</html>