我在这里下面的教程 http://www.blackweb20.com/2010/01/11/creating-your-own-google-chrome-extension/Chrome扩展程序:打开选项卡,转到的网址,填写表格并提交形式
我可以打开罚款标签与自定义扩展并加载一个url,我想在打开的页面上填写并提交一个带有JavaScript的表单。例如,我可以在google.com上提交搜索吗?
这是我到目前为止有:
manifest.json
{
"name": "My First Extension",
"version": "1.0",
"description": "The first extension that I made.",
"browser_action": {
"default_icon": "icon.png"
},
"background_page": "background.html",
"permissions": [
"tabs"
]
}
background.html
<script>
// get tab http://stackoverflow.com/questions/1979583/how-can-i-get-the-url-for-a-google-chrome-tab
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.create({'url': "http://google.com"}, function(tab) {
// Tab opened. Wait until page loads, from here it is not working
jQuery(document).ready(function() {
jQuery('#tsf').submit();
});
});
});
</script>