View Single Post
  #1 (permalink)  
Old February 17th, 2017, 10:25 AM
irfaan102 irfaan102 is offline
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Browser Sniffing problem

Hi,
The output is giving me 10 as value, whereas it should be 10.0
Here is the code:

HTML Code:
<script>
var browserString = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729)";
var browserName = "MSIE";
var findingIndex = browserString.indexOf(browserName) + browserName.length + 1;
var browserVersion = parseFloat(browserString.substring(findingIndex, findingIndex+3));
document.write(browserVersion);
</script>
Reply With Quote