Chrome扩展程序空白

时间:2017-12-07 22:35:18

标签: javascript jquery html google-chrome google-chrome-extension

我正在尝试将当前标签的域名搜索到此网址:" https://www.owler.com/iaApp/browsecompanyprofiles.htm?searchTerm=" + window.location.hostname。

它适用于我在线使用的编辑器,如JSbin等,但每当我将其上传到谷歌时,它都是一个空白的弹出窗口。我错过了什么。我知道我的popup.html中不应该有脚本,所以我创建了一个单独的文件,但它仍然无法正常工作。

这是我的js和html文件。



function newDoc() {
   window.location.assign("https://www.owler.com/iaApp/browsecompanyprofiles.htm?searchTerm=" + window.location.hostname)
}

document.addEventListener('DOMContentLoaded', function() {
  newDoc();
});

<!DOCTYPE html>
<html>
	<head>
	</head>
<body>
<script id="jsbin-javascript">
function newDoc() {
   window.location.assign("https://www.owler.com/iaApp/browsecompanyprofiles.htm?searchTerm=" + window.location.hostname)
}

document.addEventListener('DOMContentLoaded', function() {
  newDoc();
});
</script>



<script id="jsbin-source-javascript" type="text/javascript">function newDoc() {
   window.location.assign("https://www.owler.com/iaApp/browsecompanyprofiles.htm?searchTerm=" + window.location.hostname)
}

document.addEventListener('DOMContentLoaded', function() {
  newDoc();
});
</script></body>
</html>

<style>
html, body{
 width: 350px;
    height: 600px;
    border: none;
    margin: 0px;
    padding: 0px;
}
</style>
&#13;
&#13;
&#13;

mainfest.json:

 {
  "manifest_version": 2,

  "name": "Owler",
  "description": "Pull company information from any URL",
  "version": "1.0",
"icons": {
        "48": "icon-48.png",
        "128": "icon-100.png"
    },  
"permissions": [
              "activeTab", "tabs", "<all_urls>"
             ],
 "browser_action": {
 "default_icon": "icon.png",
 "default_popup": "popup.html"
}
}

0 个答案:

没有答案