I am writing a chrome extension that will allow transliteration for certain text fields on facebook.
I used the script tab to load https://www.google.com/jsapi in background.html
here is the code i used in the content script i tried to load using ajax and common path.
when i checked it google said undefined.
var script = document.createElement("script"); script.setAttribute('type','text/javascript'); script.setAttribute('src','https://www.google.com/jsapi?'+(new Date()).getTime()); document.body.appendChild(script); $(document).ready(function() { alert(google) if(window.location.href.indexOf('facebook.com')) yes_it_is_facebook(); }) function yes_it_is_facebook() {
and I have https://www.google.com/jsapi in the manifest.json script array.
"content_scripts": [ { "matches": ["<all_urls>"], "js": ["js/jquery-1.7.2.min.js", "js/myscript.js", "https://www.google.com/jsapi"] } ],
he showed an error
Failed to load javascript https://www.google.com/jsapi for content script
here is my manifest. json
{ "name": "Facebook Tamil Writer", "version": "1.0", "description": "Facebook Tamil Writer", "browser_action": { "default_icon": "images/stick-man1.gif", "popup":"popup.html" }, "background_page": "background.html", "content_scripts": [ { "matches": ["<all_urls>"], "js": ["js/jquery-1.7.2.min.js", "js/myscript.js", "https://www.google.com/jsapi"] } ], "permissions": [ "http://*/*", "https://*/*", "contextMenus", "tabs" ] }
in that I added https://www.google.com/jsapi for your understanding, and I also checked the removal of this.
since I can load this javascript into the document context. that is, when a web page ever loads ... here I specifically download for facebook. nevertheless, I need to fix the condition index because it does not give the correct result, but this is not a problem for this context of my question.
so please suggest me.