Chrome Extension to get URL and append ending -


i new js , chrome extentions , trying make chrome extension gets current tabs url , adds '&flash=on' @ end. code doesn't seem want work right

manifest.json      {   "name": "flashon chrome",   "version": "0.1",   "description": "changes default flash player", "permissions": [     "tabs"],  "content_scripts": [     {       "matches": ["http://www.stream.com/*"],        "js": ["script.js"]     }   ] }   script.js      function updateurl(tab){         var currenturl = tab.url         var newurl = currenturl.replace(currenturl + "&flash=on");        chrome.tabs.update(tab.id, {url: newurl});}   chrome.browseraction.onclicked.addlistener(function(tab) {updateurl(tab);}); 

its streaming site has html5 video , flash video flash accessible adding &flash=on end of url

not sure you're trying accomplish here: trying change location of page, current url url &flash=on` added on it?

also -- script here seems incomplete: provide complete script?

one obvious problem: you've got currenturl , currenturl:

var newurl = currenturl.replace(currenturl + "&flash=on"); 

note in content script can , set url of page location.href.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -