bep40 commited on
Commit
6bdb3f6
verified
1 Parent(s): c0d8daa

Fix VTVGO popup - fallback to new window if iframe blocked

Browse files
Files changed (1) hide show
  1. static/yt_live.js +2 -12
static/yt_live.js CHANGED
@@ -843,20 +843,10 @@
843
  if (loader) loader.style.display = 'none';
844
  };
845
  iframe.onerror = () => {
846
- const loader = document.getElementById('vtv-popup-loader');
847
- if (loader) loader.innerHTML = '<div style="color:#e74c3c">Kh么ng t岷 膽瓢峄 n峄檌 dung. <button onclick="closeVtvPopup()" style="margin-left:8px;background:#333;border:1px solid #666;color:#fff;padding:4px 8px;border-radius:4px;cursor:pointer">膼贸ng</button>';
848
  };
849
 
850
- // Check if iframe is blocked by X-Frame-Options (detect after timeout)
851
- setTimeout(() => {
852
- const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
853
- if (!iframeDoc || iframeDoc.body.childElementCount === 0) {
854
- // Fallback: open in new window
855
- window.open(popupUrl, '_blank');
856
- closeVtvPopup();
857
- }
858
- }, 3000);
859
-
860
  frame.appendChild(iframe);
861
  popup.classList.add('show');
862
  }
 
843
  if (loader) loader.style.display = 'none';
844
  };
845
  iframe.onerror = () => {
846
+ window.open(popupUrl, '_blank');
847
+ closeVtvPopup();
848
  };
849
 
 
 
 
 
 
 
 
 
 
 
850
  frame.appendChild(iframe);
851
  popup.classList.add('show');
852
  }