Robert Baer
unread,Mar 23, 2014, 8:43:12 PM3/23/14You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I have the following code that works to a point:
<script>
// discover if browser is crappy Opera or crappy Safari
str=navigator.userAgent; // Agent is unique for our purposes
var sf=str.indexOf("Safari"); // found if browser is Chrome or Safari
var ch=str.indexOf("Chrome"); // not found if browser is Safari
var op=str.indexOf("Opera"); // unique for Opera
var opt=1; // alternate shown below but not used
ovar=window.opera; // is undefined if browser is not Opera
if (!ovar) { opt=-1; } // unique for Opera
// Safari gives sf=91,ch=-1; Opera gives sf=-1,op=7; Chrome gives
sf=-1,ch>0.
// Jump to different markup if crappy browser
if (sf>0 && ch<0 || op>=0) { window.location.replace('Mobile.html'); }
// ** NOTE treat crap as if mobile phone **
// Code is a one-pager; there are mobile phones that struggle and die with
// message "Page too large" "open media site"
var isIE=str.indexOf("IE"); // not found in other browsers
if (isIE>0) { window.location.replace('PCbase.html'); }
var isMozilla=str.indexOf("Mozilla"); // Presumes in all variants;
includes Netscape
if (isMozilla>=0) { window.location.replace('PCbase.html'); }
if (ch>=0) { window.location.replace('PCbase.html'); } // for Chrome
document.write(str+"<BR>");
document.write("At this point, browser is not Safari, Chrome, Opera or
IE or Mozilla"+"<BR>");
// So, ASSuME we have mobile phone browser
// window.location.replace('Mobile.html');
// -----^ always executes; previous valid .replace somehow bypassed
</script>
If i un-comment that last window.location.replace line, the proper
execution of going to PCbase.html fails, and i get Mobile.html instead.
How can this be fixed?