-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mmiscool
authored and
mmiscool
committed
Aug 25, 2023
1 parent
92cf2ce
commit c244bc2
Showing
4 changed files
with
79 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
// check for common mobile user agents | ||
if ( | ||
navigator.userAgent.match(/Android/i) || | ||
navigator.userAgent.match(/webOS/i) || | ||
navigator.userAgent.match(/iPhone/i) || | ||
navigator.userAgent.match(/iPad/i) || | ||
navigator.userAgent.match(/iPod/i) || | ||
navigator.userAgent.match(/BlackBerry/i) || | ||
navigator.userAgent.match(/Windows Phone/i) | ||
) { | ||
// the user is using a mobile device, so redirect to the mobile version of the website | ||
try { | ||
//detect iframe parent and see if it is the mobile mouse | ||
//if frame is loaded in mouse page do nothing otherwise redirect to mouse page | ||
if ( window.location.pathname == window.parent.location.pathname ) { | ||
//test if parent is mobile mouse emulator page and redirect if not | ||
if (!window.parent.location.pathname.includes("/mouse.html")){ | ||
window.location = "./mouse.html" + window.location.search; | ||
} | ||
} | ||
} catch { } | ||
} | ||
// check for common mobile user agents | ||
if ( | ||
navigator.userAgent.match(/Android/i) || | ||
navigator.userAgent.match(/webOS/i) || | ||
navigator.userAgent.match(/iPhone/i) || | ||
navigator.userAgent.match(/iPad/i) || | ||
navigator.userAgent.match(/iPod/i) || | ||
navigator.userAgent.match(/BlackBerry/i) || | ||
navigator.userAgent.match(/Windows Phone/i) | ||
) { | ||
// the user is using a mobile device, so redirect to the mobile version of the website | ||
try { | ||
//detect iframe parent and see if it is the mobile mouse | ||
//if frame is loaded in mouse page do nothing otherwise redirect to mouse page | ||
if (window.location.pathname == window.parent.location.pathname) { | ||
//test if parent is mobile mouse emulator page and redirect if not | ||
if (!window.parent.location.pathname.includes("/mouse.html")) { | ||
window.location = "./mouse.html" + window.location.search; | ||
} | ||
} | ||
} catch {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.