Just like in the topic: how can I display a message (div) when an user uses browsers older than: IE 10, Firefox 39, Chrome 39, Opera 8? Or other words: how can I hide a div when an user uses browsers: IE 10+, Firefox 39+, Oper 8+ ? Thanks in advance for help.
Asked
Active
Viewed 265 times
0
-
4[try this](http://stackoverflow.com/questions/5916900/how-can-you-detect-the-version-of-a-browser) – Amresh Venugopal Apr 22 '16 at 09:53
-
1http://api.jquery.com/jquery.browser/ – nikhil mehta Apr 22 '16 at 09:53
-
jQuery.browser has been deprecated since 1.9.1 - NOT recommended to use this. – Stuart Apr 22 '16 at 10:06
1 Answers
0
you can Simply Check the browser details and version after that you can use your condition and implement the method of showing or hiding the div
if the condition matched or not ?
function detectBrowser(){
var N= navigator.appName;
var UA= navigator.userAgent;
var temp;
var browserVersion= UA.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
if(browserVersion && (temp= UA.match(/version\/([\.\d]+)/i))!= null)
browserVersion[2]= temp[1];
browserVersion= browserVersion? [browserVersion[1], browserVersion[2]]: [N, navigator.appVersion,'-?']; return browserVersion;
};
detectBrowser();

Akhilesh Singh
- 1,724
- 2
- 19
- 35