-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb.html
More file actions
66 lines (66 loc) · 1.74 KB
/
b.html
File metadata and controls
66 lines (66 loc) · 1.74 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
window.addEventListener('message', function (event) {
document.getElementById('content').innerHTML += event.data + '<br/>';
}, false);
</script>
</head>
<body>
Web page from http://localhost:63342
<div id="content"></div>
<a href="" target="" title="">2</a>
<script typet="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
var str = window.location.href.substr(-1, 1);
// $.ajax({
// type: 'get',
// url: 'http://www.domain.com/a.php' + '?m=' + str,
// async: true,
// success: function (res) {
// window.name = res;
// },
// error: function () {
// window.name = 'error'
// }
// })
var csHub = window.csHub = {
init: function (origin) {
this.originRule = origin;
},
get: function (key) {
return JSON.stringify(window.localStorage.getItem(key));
},
set: function (key, value) {
window.localStorage.setItem(key, JSON.stringify(value));
},
del: function (key) {
window.localStorage.removeItem(key);
}
};
window.addEventListener('message', function (event) {
// var message = JSON.parse(event.data), result, err = null;
// if (csHub.originRule.test(event.origin)) {
// try {
// result = csHub[message.method](message.key, message.value);
// }
// catch (e) {
// err = {
// message: e.message,
// stack: e.stack
// }
// }
// window.parent.postMessage(JSON.stringify({
// error: err,
// method: message.method,
// key: message.key,
// result: result
// }), event.origin);
// }
}, false);
</script>
</body>
</html>