🔄 Update Available
New version ready. Reloading...
async function forceHorizontalMode() {
try {
if ('orientation' in screen && 'lock' in screen.orientation) {
// Try to lock to landscape
await screen.orientation.lock('landscape-primary').catch(async (e) => {
console.warn('landscape-primary failed, trying landscape:', e);
return screen.orientation.lock('landscape');
});
console.log('✅ Screen locked to LANDSCAPE mode');
} else {
console.warn('⚠️ Screen Orientation API not available');
}
} catch (error) {
console.error('❌ Error forcing landscape mode:', error);
}
}
// Force landscape when page loads
window.addEventListener('load', () => {
forceHorizontalMode();
});
// Force landscape when app comes to foreground
window.addEventListener('resume', () => {
forceHorizontalMode();
});
// Re-apply on visibility change
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') {
console.log('📱 App came to foreground - enforcing landscape');
forceHorizontalMode();
}
});
// Handle orientation changes - keep forcing landscape
window.addEventListener('orientationchange', () => {
console.log('📱 Orientation change detected - re-enforcing landscape');
forceHorizontalMode();
});
// Apply landscape styles immediately
document.documentElement.style.width = '100vw';
document.documentElement.style.height = '100vh';
document.body.style.width = '100vw';
document.body.style.height = '100vh';
document.body.style.overflow = 'hidden';
// Prevent portrait orientation by hiding the app when in portrait
function enforceHorizontalView() {
const width = window.innerWidth;
const height = window.innerHeight;
const isPortrait = height > width;
if (isPortrait) {
console.warn('⚠️ Portrait mode detected - forcing landscape');
forceHorizontalMode();
}
}
// Check orientation every 500ms
setInterval(enforceHorizontalView, 500);
// Initial check
enforceHorizontalView();
// Log orientation status
console.log(`📐 Initial orientation: ${window.innerWidth}x${window.innerHeight}`);
console.log(window.innerHeight > window.innerWidth ? '⚠️ PORTRAIT' : '✅ LANDSCAPE');