-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
71 lines (65 loc) · 2.03 KB
/
index.html
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
67
68
69
70
71
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>XXX的个人简历</title>
<!-- 引入PDF.js所需的CSS -->
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden; /* 隐藏超出iframe的内容 */
}
#pdf-container {
position: relative;
height: 100vh; /* 或其他适合的高度 */
width: 100vw; /* 或其他适合的宽度 */
overflow: hidden; /* 允许内容滚动 */
}
/* 如果使用的是PDF.js Viewer的IFrame方式 */
iframe.pdf-viewer {
width: 100%;
height: 100%;
}
iframe {
width: 100%;
height: 100%;
border: none; /* 移除iframe的边框 */
}
</style>
<link rel="stylesheet" href="pdfjs/web/viewer.css">
<!-- 引入PDF.js核心库及依赖项 -->
<script src="pdfjs/build/pdf.js"></script>
<script src="pdfjs/build/pdf.worker.js"></script>
<!-- 引入PDF.js Viewer组件 -->
<script src="pdfjs/web/viewer.js"></script>
</head>
<body>
<div id="pdf-container">
<iframe id="pdf-iframe" src="pdfjs/web/viewer.html?file=template.pdf" frameborder="0" width="100%" height="100%"></iframe>
</div>
<script>
function sendHeartbeat() {
setInterval(() => {
// 每两秒发送一次心跳请求
fetch('./heartbeat.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ userId: '123', timestamp: new Date().getTime() }),
})
.then(response => response.json())
.then(data => console.log(data))
.catch((error) => console.error('Error:', error));
}, 2000);
}
// 页面加载完成后开始发送心跳
document.addEventListener('DOMContentLoaded', (event) => {
sendHeartbeat();
});
</script>
</body>
</html>