diff --git a/index.html b/index.html index 3a4a67c..69867fe 100644 --- a/index.html +++ b/index.html @@ -276,19 +276,7 @@ title.includes("cannot") || title.includes("denied") ) { - fumble(); - return; - } - - frame.focus(); - try { - frame.contentWindow.focus(); - } catch (e) { - // Ignore cross-origin errors - } - } catch (e) { - // Only show modal for mixed content errors - if (e.toString().includes("mixed active content")) { + // Show blocked content modal const blockedModal = document.getElementById('blockedModal'); const retryBtn = document.getElementById('blockedRetryBtn'); const openBtn = document.getElementById('blockedOpenBtn'); @@ -307,14 +295,8 @@ }; return; } - // For other errors, just try another site - fumble(); - } - }; - - // Also update error handler to check for mixed content - frame.onerror = (error) => { - if (error && error.toString().includes("mixed active content")) { + } catch (e) { + // Show blocked content modal for CORS errors too const blockedModal = document.getElementById('blockedModal'); const retryBtn = document.getElementById('blockedRetryBtn'); const openBtn = document.getElementById('blockedOpenBtn'); @@ -331,9 +313,35 @@ blockedModal.classList.remove('show'); fumble(); }; - } else { - fumble(); // For other errors, just try another site + return; } + + frame.focus(); + try { + frame.contentWindow.focus(); + } catch (e) { + // Ignore cross-origin errors + } + }; + + // Also handle load errors + frame.onerror = () => { + const blockedModal = document.getElementById('blockedModal'); + const retryBtn = document.getElementById('blockedRetryBtn'); + const openBtn = document.getElementById('blockedOpenBtn'); + + blockedModal.classList.add('show'); + + retryBtn.onclick = () => { + blockedModal.classList.remove('show'); + fumble(); + }; + + openBtn.onclick = () => { + window.open(frame.src, '_blank'); + blockedModal.classList.remove('show'); + fumble(); + }; }; };