@@ -27,7 +27,7 @@ class MobileDetection {
2727 ] ;
2828
2929 // Check screen size (additional check for small screens)
30- const isSmallScreen = window . innerWidth <= 768 || window . innerHeight <= 600 ;
30+ const isSmallScreen = window . innerWidth <= 1000 || window . innerHeight <= 1000 ;
3131
3232 // Check touch capability
3333 const isTouchDevice = 'ontouchstart' in window || navigator . maxTouchPoints > 0 ;
@@ -244,9 +244,119 @@ class MobileDetection {
244244 }
245245
246246 continueAnyway ( ) {
247+ this . forceDesktopMode ( ) ;
247248 this . hideOverlay ( ) ;
248249 }
249250
251+ forceDesktopMode ( ) {
252+ // Method 1: Set viewport to desktop width
253+ let viewport = document . querySelector ( 'meta[name="viewport"]' ) ;
254+ if ( viewport ) {
255+ viewport . setAttribute ( 'content' , 'width=1024, initial-scale=0.5, user-scalable=yes' ) ;
256+ } else {
257+ // Create viewport meta tag if it doesn't exist
258+ viewport = document . createElement ( 'meta' ) ;
259+ viewport . name = 'viewport' ;
260+ viewport . content = 'width=1024, initial-scale=0.5, user-scalable=yes' ;
261+ document . head . appendChild ( viewport ) ;
262+ }
263+
264+ // Method 2: Add CSS to force desktop layout
265+ const desktopModeStyles = `
266+ <style id="desktop-mode-override">
267+ /* Force desktop layout */
268+ body {
269+ min-width: 1024px !important;
270+ overflow-x: auto !important;
271+ }
272+
273+ /* Enable zoom and pan */
274+ html {
275+ transform-origin: 0 0;
276+ width: 1024px !important;
277+ }
278+
279+ /* Prevent mobile-specific responsive styles */
280+ @media screen and (max-width: 768px) {
281+ * {
282+ max-width: none !important;
283+ width: auto !important;
284+ }
285+ }
286+
287+ /* Ensure content is scrollable horizontally */
288+ * {
289+ box-sizing: border-box;
290+ }
291+ </style>
292+ ` ;
293+
294+ // Remove existing desktop mode styles if any
295+ const existingStyles = document . querySelector ( '#desktop-mode-override' ) ;
296+ if ( existingStyles ) {
297+ existingStyles . remove ( ) ;
298+ }
299+
300+ // Add new desktop mode styles
301+ document . head . insertAdjacentHTML ( 'beforeend' , desktopModeStyles ) ;
302+
303+ // Method 3: Try to trigger browser's request desktop site (limited browser support)
304+ try {
305+ // Some browsers support this property
306+ if ( 'requestDesktopSite' in navigator ) {
307+ navigator . requestDesktopSite ( ) ;
308+ }
309+
310+ // Alternative approach: modify user agent string for future requests
311+ if ( 'userAgentData' in navigator ) {
312+ navigator . userAgentData . mobile = false ;
313+ }
314+ } catch ( e ) {
315+ console . log ( 'Browser does not support programmatic desktop mode switching' ) ;
316+ }
317+
318+ // Method 4: Show instruction overlay if automatic methods don't work
319+ setTimeout ( ( ) => {
320+ if ( window . innerWidth <= 768 ) {
321+ this . showDesktopModeInstructions ( ) ;
322+ }
323+ } , 1000 ) ;
324+ }
325+
326+ showDesktopModeInstructions ( ) {
327+ // Create instruction overlay
328+ const instructionOverlay = document . createElement ( 'div' ) ;
329+ instructionOverlay . id = 'desktop-mode-instructions' ;
330+ instructionOverlay . innerHTML = `
331+ <div class="mobile-overlay-backdrop">
332+ <div class="mobile-overlay-content">
333+ <div class="mobile-overlay-icon">
334+ <svg width="48" height="48" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
335+ <path d="M13 16H21L19 18L21 20H13V16ZM3 4V20H11V22H1V2H11V4H3Z" fill="#3b82f6"/>
336+ </svg>
337+ </div>
338+ <h2 class="mobile-overlay-title">Enable Desktop Mode</h2>
339+ <p class="mobile-overlay-description">
340+ For the best experience, please enable "Desktop Mode" or "Request Desktop Site" in your browser:
341+ </p>
342+ <ul class="mobile-overlay-list">
343+ <li><strong>Chrome/Edge:</strong> Menu → "Desktop site" checkbox</li>
344+ <li><strong>Firefox:</strong> Menu → "Desktop site" toggle</li>
345+ <li><strong>Safari:</strong> Share button → "Request Desktop Website"</li>
346+ <li><strong>Samsung Internet:</strong> Menu → "Desktop mode"</li>
347+ </ul>
348+ <div class="mobile-overlay-actions">
349+ <button class="mobile-overlay-btn mobile-overlay-btn-primary" onclick="this.parentElement.parentElement.parentElement.parentElement.remove()">
350+ I've Enabled Desktop Mode
351+ </button>
352+ </div>
353+ </div>
354+ </div>
355+ ` ;
356+
357+ document . body . appendChild ( instructionOverlay ) ;
358+ }
359+
250360 goBack ( ) {
251361 // Try to go back in history, or redirect to a homepage if available
252362 if ( window . history . length > 1 ) {
0 commit comments