-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.html
55 lines (55 loc) · 1.81 KB
/
popup.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
<!DOCTYPE html>
<html>
<head>
<title>popup页</title>
<meta charset="utf-8"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body {
font-family: 'Microsoft Yahei';
width: 500px;
min-height: 100px;
}
button {margin: 10px; cursor: pointer}
</style>
</head>
<body>
<h1>这是一个popup页面!</h1>
<h2>background</h2>
<div>
<button id="open_background">打开background</button>
<button id="invoke_background_js">调用background页JS方法</button>
<button id="get_background_title">获取background页的标题</button>
</div>
<h2>窗口操作demo</h2>
<div>
<button id="open_new_window">打开新窗口</button>
<button id="min_current_window">将当前窗口最小化</button>
<button id="close_current_window">关闭当前窗口所有标签</button>
</div>
<h2>标签操作demo</h2>
<div>
<button id="open_url_new_tab">新标签打开百度</button>
<button id="open_url_current_tab">当前标签打开网页</button>
<button id="get_current_tab_id">获取当前标签页ID</button>
<button id="highlight_tab">切换到第一个标签</button>
</div>
<h2>DOM交互demo</h2>
<div>
<button id="update_bg_color">修改页面背景色(通过executeScript实现)</button>
<button id="update_font_size">修改字体大小(通过sendMessage实现)</button>
</div>
<div>
<button id="show_badge">显示badge</button>
<button id="hide_badge">隐藏badge</button>
<button id="show_notification">显示桌面通知</button>
<button id="check_media">检测网页视频</button>
</div>
<h2>popup与content-script交互</h2>
<div>
<button id="send_message_to_content_script">发送消息到content-script</button>
</div>
<script type="text/javascript" src="js/jquery-3.5.1.js"></script>
<script type="text/javascript" src="js/popup.js"></script>
</body>
</html>