I am having trouble getting my extension to redirect some urls.
This is the object I am trying to get to redirect:
<object type="application/x-shockwave-flash" id="ytp" data="http://www.youtube.com/v/GVwh8FEsWUk?start=0&version=3&autoplay=1&border=0&cc_load_policy=0&controls=0&disablekb=1&egm=0&enablejsapi=1&hd=1&iv_load_policy=3&modestbranding=1&playerapiid=ytp&rel=0&showinfo=0&showsearch=0" width="100%" height="100%"><param name="quality" value="high"><param name="wmode" value="opaque"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="false"><param name="bgcolor" value="#000000"></object>
It exists on yt-plg.appspot.com
manifest.json (with some omitted bits):
"background" : {
"scripts": ["resources/js/events-bg.js"]
},
...
"permissions": [
"*://*.plug.dj/*",
"http://plug.myuplay.com/*",
"http://yt-plg.appspot.com/*",
"webRequest",
"storage",
"notifications",
"contextMenus"
],
events-bg.js:
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
if (details.url.indexOf("html5=1")!=-1) return {};
console.log(details.url);
return {
redirectUrl: details.url.replace("&?html5=[(true|false)01]","") + "&html5=1"
};
},
{
urls: ["http://www.youtube.com/v/*"]
},
["blocking"]
);
Essentially, my goal is to force html5 on this player. If this is not possible to do this in this fashion, I can always use code injection and do it what way. What is wrong with my present setup?
Notes: Currently the request listener is never triggered. I have set breakpoints in it and used the console logging to test this.
Update:
After screwing around in the permissions I have created a basic webRequest that should be triggered on any url but I am still not getting any results. I am going to just assume that this API needs some work still and that this is not well documented enough to see what is going wrong. I have no output whatsoever on my background page and no urls are being fixed. I will manually inject code to correct my issue instead until this can be sorted out.