mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 17:59:55 +02:00
17 lines
No EOL
839 B
JavaScript
17 lines
No EOL
839 B
JavaScript
function checkScriptBlocking() {
|
|
const url = 'https://imasdk.googleapis.com/js/sdkloader/ima3.js';
|
|
|
|
// Fetching the script with 'no-cors' mode
|
|
fetch(url, { mode: 'no-cors' })
|
|
.then(response => {
|
|
console.log('IMA SDK fetched (no-cors mode). Status might not be verifiable.', response);
|
|
// Since we can't check the status or content size, we assume it's not blocked if it gets here
|
|
blockAdBlock.onDetected(adBlockDetected); // Continue with non-blocking logic
|
|
})
|
|
.catch(error => {
|
|
console.log('Error fetching IMA SDK:', error.message);
|
|
avideoToastError('IMA not loaded'); // Display error toast
|
|
adBlockDetected(); // Assume blocked if there's an error
|
|
});
|
|
}
|
|
document.addEventListener('DOMContentLoaded', checkScriptBlocking); |