diff --git a/script.js b/script.js index 705d0a9..990042b 100644 --- a/script.js +++ b/script.js @@ -4,13 +4,29 @@ const searchForm = document.getElementById("searchForm"); const errorMessage = document.getElementById("errorMessage"); let debounceTimeout; +// Detect if the browser is running on an e-reader or tablet +function isEreaderOrTablet() { + const ua = navigator.userAgent.toLowerCase(); + return ( + ua.includes("kindle") || + ua.includes("kobo") || + ua.includes("silk") || + ua.includes("playbook") || + ua.includes("tablet") + ); +} + +// Detect if the browser is in a P2P environment function isP2PEnvironment() { const protocol = window.location.protocol; const isIpfs = protocol.startsWith("ipfs") || protocol.startsWith("ipns"); const ua = navigator.userAgent.toLowerCase(); + + // P2P browser detection const isPeersky = ua.includes("peersky"); const isAgregore = ua.includes("agregore"); - return isIpfs || isPeersky || isAgregore; + + return (isIpfs || isPeersky || isAgregore) && !isEreaderOrTablet(); } function getIpfsBaseUrl() {