WA云控,星河云控,四海云控,火箭云控,WS云控,七星云控,UU云控,INS云控,WhatsApp群发,WhatsApp云控,WhatsApp协议号,WhatsApp频道号,WhatsApp软件,星火出海营销,AK云控,浩瀚云控,007云控,聚星云控,巨鲸云控,启航云控,闪电云控,拉客宝云控,方舟云控

WhatsApp云控|WhatsApp协议号

合作咨询 TG:XH518178
创造有活力的品牌网站 提升用户体验和品牌价值感
如何破解Content Security Policy?
人气 

作者:Ran

2020-10-16 Ran

以WhatsApp网页版为例。

报错:

Refused to load the script ‘https://xxx/xxx.js’ because it violates the following Content Security Policy directive: “script-src ‘self’ data: blob: ‘unsafe-eval’ ‘unsafe-inline’ https://ajax.googleapis.com https://api.search.live.net https://maps.googleapis.com https://www.youtube.com https://s.ytimg.com”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback.

破解:

chrome.webRequest.onHeadersReceived.addListener(

function (details) {

console.log(‘Disabled CSP’, details)

for (var i = 0; i < details.responseHeaders.length; i++) {

if (details.responseHeaders[i].name.toLowerCase() === ‘content-security-policy’) {

details.responseHeaders[i].value = ”

}

}

return {

responseHeaders: details.responseHeaders

}

},

{

urls: [

‘*://*.whatsapp.com/*’

]

},

[‘blocking’, ‘responseHeaders’]

)