chrome 扩展:从弹出窗口中的表单打开新选项卡
我在 Chrome 扩展弹出窗口中有一个简单的 JavaScript 表单。单击扩展图标时,用户填写表单并单击“开始!”,这将打开一个新选项卡 - 该新选项卡的 URL 将根据表单中的值确定。
目前,弹出窗口显示良好,并且表单值填充良好。当用户单击按钮时如何打开选项卡?
(我对 javascript 很陌生,文档让我很困惑:|)
manifest.json:
{
"name": "My Helper",
"version": "1.0",
"description": "My Helper",
"background_page" : "background.html",
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
},
"permissions":
["tabs"]
}
popup.html:
<html>
<head>
<script type="text/javascript">
// some functions...
</script>
</head>
<body>
<form name="frmOne">
// input fields
<button type="button" onclick="buildTheUrl(..input values..)">Go!</button>
</form>
</body>
</html>
background.html 当前为空。
I have a simple javascript form in a chrome extension popup. When clicking the extension icon, the user fills the form and clicks "go!", which should open a new tab - the URL for this new tab will be determined according to values in the form.
Currently the popup shows fine and the form values are populated fine. How do I open the tab when the user clicks the button?
(I am pretty new with javascript and the documentation confused the hell out of me :| )
manifest.json:
{
"name": "My Helper",
"version": "1.0",
"description": "My Helper",
"background_page" : "background.html",
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
},
"permissions":
["tabs"]
}
popup.html:
<html>
<head>
<script type="text/javascript">
// some functions...
</script>
</head>
<body>
<form name="frmOne">
// input fields
<button type="button" onclick="buildTheUrl(..input values..)">Go!</button>
</form>
</body>
</html>
background.html is currently empty.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)