forked from josephj/sync-with-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomet-iframe.html
More file actions
49 lines (43 loc) · 1 KB
/
comet-iframe.html
File metadata and controls
49 lines (43 loc) · 1 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Comet</title>
<style>
iframe {
position: fixed;
right: 10px;
top: 10px;
width: 500px;
height: 500px;
}
#show {
border: solid 1px #ccc;
padding: 5px;
width: 500px;
height: 500px;
font-size: 11px;
overflow: auto;
}
</style>
</head>
<body>
<h1>Comet (Forever Iframe Version)</h1>
<div id="show"></div>
<iframe src=""></iframe>
<script type="text/javascript" src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>
<script type="text/javascript">
YUI().use("node-base", function (Y) {
var node = Y.one("#show"),
frame = Y.one("iframe");
// 設定 Iframe 的 Callback 方法
window.callback = function (str) {
node.append("<p>" + str + "</p>");
};
Y.later(10, null, function () {
document.getElementsByTagName("iframe")[0].src = "comet-iframe.php";
});
});
</script>
</body>
</html>