diff --git a/index.html b/index.html
index 69867fe..eb83b64 100644
--- a/index.html
+++ b/index.html
@@ -268,6 +268,30 @@
// Wait for the page to load then focus
frame.onload = () => {
try {
+ // Check if it's an HTTP URL first
+ const currentUrl = frame.contentWindow.location.href;
+ if (currentUrl.startsWith('http:')) {
+ // Show blocked content modal
+ 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(currentUrl, '_blank');
+ blockedModal.classList.remove('show');
+ fumble();
+ };
+ return;
+ }
+
+ // Check for error pages
const title = frame.contentWindow.document.title.toLowerCase();
if (
title.includes("blocked") ||
@@ -276,7 +300,19 @@
title.includes("cannot") ||
title.includes("denied")
) {
- // Show blocked content modal
+ fumble(); // Just try another site for error pages
+ return;
+ }
+
+ frame.focus();
+ try {
+ frame.contentWindow.focus();
+ } catch (e) {
+ // Ignore cross-origin errors - these are normal for HTTPS sites
+ }
+ } catch (e) {
+ // Only show blocked modal if it's an HTTP site
+ if (frame.src.startsWith('http:')) {
const blockedModal = document.getElementById('blockedModal');
const retryBtn = document.getElementById('blockedRetryBtn');
const openBtn = document.getElementById('blockedOpenBtn');
@@ -295,53 +331,13 @@
};
return;
}
- } 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');
-
- blockedModal.classList.add('show');
-
- retryBtn.onclick = () => {
- blockedModal.classList.remove('show');
- fumble();
- };
-
- openBtn.onclick = () => {
- window.open(frame.src, '_blank');
- blockedModal.classList.remove('show');
- fumble();
- };
- return;
- }
-
- frame.focus();
- try {
- frame.contentWindow.focus();
- } catch (e) {
- // Ignore cross-origin errors
+ // Otherwise ignore CORS errors - these are normal for HTTPS sites
}
};
- // Also handle load errors
+ // 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();
- };
+ fumble(); // Just try another site for load errors
};
};