inital-release
This commit is contained in:
@@ -11,20 +11,27 @@
|
||||
|
||||
// Detect device type
|
||||
const width = window.innerWidth
|
||||
const isMobileDevice = /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
|
||||
const isTabletDevice = /iPad|Android/i.test(navigator.userAgent) && !isMobileDevice
|
||||
const height = window.innerHeight
|
||||
const userAgent = navigator.userAgent
|
||||
|
||||
// Better mobile detection
|
||||
const isMobilePhone = /Android.*Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)
|
||||
const isTabletDevice = /iPad|Android(?!.*Mobile)/i.test(userAgent)
|
||||
|
||||
let targetPage = null
|
||||
|
||||
// Determine target page based on device and screen size
|
||||
if (width < 600 || (isMobileDevice && width < 768)) {
|
||||
// Mobile: < 600px or mobile device < 768px
|
||||
if (isMobilePhone && width < 768) {
|
||||
// Mobile phones: detected mobile device < 768px
|
||||
targetPage = 'mobile.html'
|
||||
} else if (width >= 600 && width < 1024) {
|
||||
// Tablet: 600-1024px
|
||||
} else if (width < 500) {
|
||||
// Small screens: force mobile
|
||||
targetPage = 'mobile.html'
|
||||
} else if (isTabletDevice || (width >= 500 && width < 1200)) {
|
||||
// Tablets: iPad/Android tablet OR 500-1200px
|
||||
targetPage = 'tablet.html'
|
||||
} else {
|
||||
// Desktop: >= 1024px
|
||||
// Desktop: >= 1200px
|
||||
targetPage = 'index.html'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user