jquery - How to use external javascript in chrome extension -
i writing chrome extension , want use jquery , simpleweather.js.
purpose of extension show outside temperature in new tab nice background image.
when use scripts externally html site working , displays temperature extension not working.
html:
<head> <title>nová karta</title> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.simpleweather/3.1.0/jquery.simpleweather.min.js"></script> <script src="javascript.js"></script> </head>
manifest:
{ "browser_action": { "default_title": "timepage", "default_popup": "popup.html" }, "description": "", "chrome_url_overrides": { "newtab": "timepage.html" }, "permissions": [ "tabs", "cookies" ], "content_scripts": [ { "matches": [ "<all_urls>" ], "js": [ "https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js", "https://cdnjs.cloudflare.com/ajax/libs/jquery.simpleweather/3.1.0/jquery.simpleweather.min.js" ], } ], "manifest_version": 2, "name": "temperature", "version": "1.0" }
when include scripts locally html same folder timepage.html
located, site not working , does not display temperature , extension not working well.
html:
<head> <title>nová karta</title> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.css"> <script src="weather/jquery.simpleweather.min.js"></script> <script src="jquery.js"></script> <script src="javascript.js"></script> </head>
manifest:
{ "browser_action": { "default_title": "timepage", "default_popup": "popup.html" }, "description": "", "chrome_url_overrides": { "newtab": "timepage.html" }, "permissions": [ "tabs", "cookies" ], "content_scripts": [ { "matches": [ "<all_urls>" ], "js": [ "jquery.simpleweather.min.js", "jquery-3.1.1.min.js" ], } ], "manifest_version": 2, "name": "temperature", "version": "1.0" }
the problem here loading order. should call jquery first simpleweather , js afterwards.
Comments
Post a Comment