2
Chromeは「未定義のonBeforeRequestのプロパティを読み取ることができません。なぜ私は理解できません。"chrome.webRequest.onBeforeRequest"の使用方法は?
background.html:
<html>
<head>
<script type="text/javascript">// <![CDATA[
try
{
chrome.webRequest.onBeforeRequest.addListener(function(e){alert("onBeforeRequest")},{urls: ["http://*/*", "https://*/*"]}, ["blocking"]) ;
}
catch (ErrorMessage)
{
alert('page:'+ErrorMessage) ;
}
// ]]></script>
</head>
</html>
manifest.jsonを:webRequest
API要求権限に
{
"name": "first extension",
"version": "1.0",
"description": "first extension",
"browser_action": {
"default_icon": "icon.gif",
"popup": "popup.html"
},
"permissions":
["tabs", "chrome.webRequest", "webNavigation", "management", "http://*/*", "https://*/*"],
"background_page": "background.html"
}