If.... Else If.... is not giving any Output in javascript
Acctually I am matching navigation.userAgent
string of javascript with some predefined strings using If.... Else If.....
statement but the script is to long about 1.76 MB
The script contains some jquery as well as javascript codes At the time of execution I didn't get any output if condition is true as defined in If.... Else If....
statement code block. Please suggest some simple and working solution any help must be appreciated.
Edit 01
The script is attached to my Index.html with
<script>
tag'ssrc
attribute.
The actual code block is very large it is just a small code snippet of that script but the code beyond is completely similar like this one.
$(function(){
var winURL = $("body").attr("winredirection");
var androidURL = $("body").attr("androidredirection");
var mobURL = $("body").attr("mobredirection");
var bbURL = $("body").attr("bbredirection");
if (navigator.userAgent=="Mozilla/5.0 (compatible; U; ABrowse 0.6;Syllable) AppleWebKit/420+ (KHTML, like Gecko)") {
window.location.assign($("body").attr("winredirection"));
}
else if (navigator.userAgent=="Mozilla/5.0 (compatible; ABrowse 0.4; Syllable)") {
window.location.assign($("body").attr("winredirection"));
}
else if (navigator.userAgent=="Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Acoo Browser 1.98.744; .NET CLR 3.5.30729)") {
window.location.assign($("body").attr("winredirection"));
}
else if (navigator.userAgent=="Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Acoo Browser 1.98.744; .NET CLR 3.5.30729)"){window.location.assign($("body").attr("winredirection"));}else if (navigator.userAgent=="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Acoo Browser; GTB5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)"){window.location.assign($("body").attr("winredirection"));}else if (navigator.userAgent=="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; Acoo Browser; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; Avant Browser)"){window.location.assign($("body").attr("winredirection"));}
});
Edit 02
My Index.html page
<!DOCTYPE html>
<html>
<head>
<title>
Platform Identification using perfect.api.js
</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="perfect.api.js"></script>
</head>
<body winredirection="http://google.com" androidredirection="www.google.com/mobile/android" mobredirection="www.google.com/mobile" bbredirection="www.google.com/mobile/bb">
</body>
</html>
Thanks,
API Developer