-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
49 lines (45 loc) · 1.7 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document translate</title>
<style>
/* 设置 body 和 html 的高度和宽度为 100%,去除默认的边距 */
html, body {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden; /* 隐藏滚动条 */
}
/* 设置 iframe 充满整个页面,没有边框,确保无缝集成的效果 */
iframe {
width: 100%;
height: 100%;
border: none; /* 去除边框 */
}
</style>
</head>
<body>
<!-- iframe 标签,先不设置src属性 -->
<iframe id="embeddedIframe" frameborder="0" allowfullscreen>
<!-- 对于不支持 iframe 的浏览器,显示一段文本 -->
Your browser does not support iframes.
</iframe>
<script>
// JavaScript 代码用于从当前页面的URL提取查询参数并附加到iframe的src
document.addEventListener("DOMContentLoaded", function() {
var iframe = document.getElementById('embeddedIframe');
var baseIframeSrc = 'https://document-translate.streamlit.app?embed=True';
// 获取当前页面的URL参数
var urlParams = new URLSearchParams(window.location.search);
// 将这些参数添加到iframe的基本URL
urlParams.forEach(function(value, key) {
baseIframeSrc += '&' + encodeURIComponent(key) + '=' + encodeURIComponent(value);
});
// 设置iframe的src属性
iframe.src = baseIframeSrc;
});
</script>
</body>
</html>