You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
978 B
48 lines
978 B
4 years ago
|
/**
|
||
|
* This function search for third party scripts.
|
||
|
* This third party scripts can generate third party cookies.
|
||
|
*
|
||
|
* It returns a list of possible domains of third parties for the cookies.js in the pop up window
|
||
|
*/
|
||
|
|
||
|
function findThirdpartydomains(){
|
||
|
try{
|
||
|
var result = [];
|
||
|
|
||
|
//this gets the url of the third party script
|
||
|
$("script").each(function(){
|
||
|
let url = $(this).attr("src");
|
||
|
if(typeof url !== "undefined"){
|
||
|
if(url.startsWith("/")){
|
||
|
if(url.startsWith("//")){
|
||
|
result.push(url);
|
||
|
}
|
||
|
} else {
|
||
|
result.push(url);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
});
|
||
|
// For youtube
|
||
|
$("iframe").each(function(){
|
||
|
let url = $(this).attr("src");
|
||
|
if(typeof url !== "undefined"){
|
||
|
if(url.startsWith("/")){
|
||
|
if(url.startsWith("//")){
|
||
|
result.push(url);
|
||
|
}
|
||
|
} else {
|
||
|
result.push(url);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
});
|
||
|
|
||
|
console.log("--------");
|
||
|
console.log(result);
|
||
|
console.log("--------");
|
||
|
return result;
|
||
|
} catch(e){
|
||
|
console.log(e);
|
||
|
}
|
||
|
}
|