I have this site that I create, and since I do not have mobile layouts configured for people accessing it via phones and other small devices, I would kindly redirect them to a separate file mobile_redirect.htmlcontaining a link and disclaimer to the main site . From there, they can still click the link and go to the main site on their phone.
Everything that I have works, except that it will not allow me to access the main site on my phone. I believe because my global variable **hasBeenRedirected**does not set to true for a reason that I cannot understand.
The methodology used includes several files .jsediting one global variable **hasBeenRedirected**, which is declared insideindex_main.js
I tried to do this when all the user had to do was visit a separate file mobile_redirect.html(to which they are automatically linked) to set the global variable hasBeenRedirectedto true - do it where they could then go to the main site without being redirected, but I obviously missed something: P
Fragment from index_main.js:
window.hasBeenRedirected = false;
$(document).ready(function(){
"use strict";
if(screen.width <= 800 && !window.hasBeenRedirected){
window.location = "http://www.summitsets.com/mobile_redirect.html";
}
mobile_redirect.js
$(document).ready(function(){
"use strict";
window.hasBeenRedirected = true;
});
index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>The Summit Sets</title>
<link href="/css/defaultStyleSheet.css" type = "text/css" rel = "stylesheet" />
<link rel="stylesheet" href="/scripts/jquery-ui-1.12.1/jquery-ui.min.css">
<script src="https://code.jquery.com/jquery-3.1.1.js" type="text/javascript"></script>
<script src="/scripts/jquery-ui-1.12.1/jquery-ui.min.js" type = "text/javascript"></script>
<script src="/scripts/.transit script/jquery.transit.min.js" type = "text/javascript"></script>
<script src="/scripts/index_main.js"></script>
</head>
<body>
<div class = "page" id = "page_1">
<div id = "socialIconsMenu" style = "position: absolute;">
<a href = "https://www.youtube.com/channel/UCNeU3LrGEr_-peHpApCSBdQ"><img class = "socialIconsMenu_Elements" alt = "" id = "youtube" src = "/images/youtube_icon_dark.png"/></a>
<a href = "https://www.facebook.com/summitsets/"><img class = "socialIconsMenu_Elements" alt = "" id = "facebook" src = "/images/facebook_logo.png"/></a>
<a href = "https://www.instagram.com/summitsets"><img class = "socialIconsMenu_Elements" alt = "" id = "instagram" src = "/images/instagram_logo.png"/></a>
</div>
<h1 id = "SSLogoTitle" style = "opacity:1; font-size: 81px; margin-top: 0px; text-align: center;">The Summit Sets</h1>
<p id = "SSLogoUnderscore" style = "opacity:1; font-size: 28px; margin-top: 0px; text-align: center;">Integrated Entertainment</p>
</div>
</body>
</html>
mobile_redirect.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Whoops!</title>
<script src="https://code.jquery.com/jquery-3.1.1.js" type="text/javascript"></script>
<script src = "/scripts/mobile_redirect.js/" type = "text/javascript"></script>
<link href = "/css/defaultStyleSheet.css" type = "text/css" rel = "stylesheet" />
</head>
<body>
<p style ="text-align: center; font-size: 60px; font-weight: 700;" >Looks like you accessed our site from a mobile device! </p>
<p style ="text-align: center; font-size: 35px; font-weight: 200;" >Unfortunately our site is not yet designed to run smoothly
on mobile devices. You may continue if you'd like by
using the link below, but many or all features may either
not function properly--or not functional at all.
For an optimal experience, we highly suggest using
a laptop, desktop, or high performance tablet.
We apologize for the inconvenience.</p>
<a href = "http://www.summitsets.com/"><p style = "font-weight: 500; font-size: 45px; text-align: center;">Take me to the main site</p></a>
</body>
</html>
This seems like a great post, but I feel the solution is quite simple. I just wanted to provide as many resources as possible for my problem.
, , . , , .
http://www.summitsets.com
!