misc: don't load typical tracking resources (#33331)

This commit is contained in:
Frédéric Péters 2019-05-22 09:27:45 +02:00
parent b5f323ff07
commit 5b5159d2b7
2 changed files with 16 additions and 0 deletions

View File

@ -30,6 +30,14 @@ function mandaye_exit(message){
phantom.exit()
}
page.onResourceRequested = function(requestData, networkRequest) {
if (requestData.url.indexOf('google-analytics.com') !== -1 ||
requestData.url.indexOf('/piwik') !== -1) ||
requestData.url.indexOf('/matomo') !== -1) {
networkRequest.abort();
}
}
page.onResourceReceived = function(response){
if (response.url === input.address && response.status > 399){
output['result'] = 'page not found';

View File

@ -36,6 +36,14 @@ function mandaye_exit(message){
phantom.exit()
}
page.onResourceRequested = function(requestData, networkRequest) {
if (requestData.url.indexOf('google-analytics.com') !== -1 ||
requestData.url.indexOf('/piwik') !== -1) ||
requestData.url.indexOf('/matomo') !== -1) {
networkRequest.abort();
}
}
page.onError = function(msg, trace){
var err_stack = ['ERROR: ' + msg];