-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdomain1.html
More file actions
executable file
·27 lines (25 loc) · 1.01 KB
/
Copy pathdomain1.html
File metadata and controls
executable file
·27 lines (25 loc) · 1.01 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
<html>
<head>
<meta charset="utf8">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="description" content="cross domain talk">
<meta name="author" content="Matt McAlear">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Domain 1</title>
<script type="text/javascript" src="js/crossDomainData.js"></script>
</head>
<body>
<h1>Domain 1</h1>
<div id="data"></div>
<script type="text/javascript">
var key = "KeyName";
var remoteStorage = new CrossDomainData("http://localhost", "/crossDomainData/domain2.html");
var refreshIntervalId = setInterval(function(){ //The first iteration init's it, the next are sending request once iFrame loads
if(remoteStorage.requestData(key, "local")){ //Key, storage type
clearInterval(refreshIntervalId);
document.getElementById('data').innerHTML=localStorage.getItem(key);
}
}, .1);
</script>
</body>
</html>