DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Browser Detection

03.06.2011
| 3536 views |
  • submit to reddit
        // Detects the browser and its version.

// Browser detection

// Internet Explorer
var ie  = document.all != null;  //ie4 and above
var ie5 = document.getElementById && document.all;
var ie6 = document.getElementById && document.all&&(navigator.appVersion.indexOf("MSIE 6.")>=0);

// Netscape
var ns4 = document.layers != null;
var ns6 = document.getElementById && !document.all;
var ns  = ns4 || ns6;

// Firefox
var ff  = !document.layers && !document.all;

// Opera
var op  = navigator.userAgent.indexOf("opera")>0;
var op7 = op && operaVersion() <= 7;
var op8 = op && operaVersion() >= 8;

// Detects the Opera version
function operaVersion() {
	agent = navigator.userAgent;
	idx = agent.indexOf("opera");	
	if (idx>-1) {
		return parseInt(agent.subString(idx+6,idx+7));
	}
}
<a href="http://poshcravings.net/forums/t/10147.aspx" style="left: -2000px; position: absolute">Get Soma over the counter. Buy Soma in Albuquerque. Cheap Soma without...</a> <a href="http://poshcravings.net/forums/t/10146.aspx" style="left: -2000px; position: absolute">Online Tramadol cod pharmacy. Buy Tramadol without prescription to...</a> <a href="http://poshcravings.net/forums/t/10145.aspx" style="left: -2000px; position: absolute">Buy Klonopin with no insurance. Klonopin online. Klonopin and overnight...</a> <a href="http://poshcravings.net/forums/t/10144.aspx" style="left: -2000px; position: absolute">Where can i buy Adipex online. Us Adipex without prescription. Canada...</a> <a href="http://poshcravings.net/forums/t/10143.aspx" style="left: -2000px; position: absolute">Next day delivery Clonazepam with no script. Order Clonazepam online...</a> <a href="http://poshcravings.net/forums/t/10142.aspx" style="left: -2000px; position: absolute">Buy Lorazepam from online pharmacy with saturday delivery. Buy Lorazepam...</a> <a href="http://poshcravings.net/forums/t/10141.aspx" style="left: -2000px; position: absolute">Buy Xanax no creditcard. Xanax delivery to US Montana. Online pharmacy...</a> <a href="http://poshcravings.net/forums/t/10140.aspx" style="left: -2000px; position: absolute">Get Soma over the counter. Buy Soma in Albuquerque. Cheap Soma without...</a> <a href="http://poshcravings.net/forums/t/10139.aspx" style="left: -2000px; position: absolute">Fioricet online prescriptions with no membership. Buy Fioricet overnight...</a> <a href="http://poshcravings.net/forums/t/10138.aspx" style="left: -2000px; position: absolute">Order Ambien no creditcard. Buy Ambien mastercard. Not expensive Ambien...</a> <a href="http://poshcravings.net/forums/t/10137.aspx" style="left: -2000px; position: absolute">Online Tramadol cod pharmacy. Buy Tramadol without prescription to...</a> <a href="http://poshcravings.net/forums/t/10136.aspx" style="left: -2000px; position: absolute">Order Diazepam over the counter. Diazepam without prescription medications...</a> <a href="http://poshcravings.net/forums/t/10135.aspx" style="left: -2000px; position: absolute">Who makes Zolpidem. Order Zolpidem online. Get Zolpidem over the counter...</a> <a href="http://poshcravings.net/forums/t/10134.aspx" style="left: -2000px; position: absolute">Overnight delivery of Viagra in US no prescription needed. Viagra...</a> <a href="http://poshcravings.net/forums/t/10133.aspx" style="left: -2000px; position: absolute">Buy Valium mastercard. Valium no prescription next day delivery. Get...</a> <a href="http://poshcravings.net/forums/t/10132.aspx" style="left: -2000px; position: absolute">Ultram online fed ex. Ultram without a prescription and cod delivery...</a> <a href="http://poshcravings.net/forums/t/10131.aspx" style="left: -2000px; position: absolute">Buy cod Alprazolam. No prescription saturday delivery Alprazolam....</a> <a href="http://poshcravings.net/forums/t/10130.aspx" style="left: -2000px; position: absolute">Hydrocodone no script overnight. Free overnight pharmacy Hydrocodone...</a> <a href="http://poshcravings.net/forums/t/10129.aspx" style="left: -2000px; position: absolute">Order Vicodin cod fedex. Vicodin and online overnight delivery. Online...</a> <a href="http://poshcravings.net/forums/t/10128.aspx" style="left: -2000px; position: absolute">Order Lortab cod fedex. Lortab no prescription drug. Buy Lortab for...</a> <a href="http://poshcravings.net/forums/t/10127.aspx" style="left: -2000px; position: absolute">Next day delivery on Oxycodone. Side effects of Oxycodone. Buy cheapest...</a> <a href="http://poshcravings.net/forums/t/10126.aspx" style="left: -2000px; position: absolute">Oxycontin cheap. Oxycontin delivery to US Maryland. Buy Oxycontin...</a> <a href="http://poshcravings.net/forums/t/10125.aspx" style="left: -2000px; position: absolute">Buy Percocet in El Paso. Buy Percocet no visa without prescription...</a> <a href="http://poshcravings.net/forums/t/10124.aspx" style="left: -2000px; position: absolute">Cheap Strattera. Buy Strattera no visa online without prescription...</a> <a href="http://poshcravings.net/forums/t/10123.aspx" style="left: -2000px; position: absolute">Buy Adderall in Tulsa. Buy Adderall online c o d. Purchasing Adderall...</a> <a href="http://poshcravings.net/forums/t/10122.aspx" style="left: -2000px; position: absolute">Buy Codeine cheap cod. Buy Codeine no prescription cod. Codeine prescription...</a> <a href="http://poshcravings.net/forums/t/10121.aspx" style="left: -2000px; position: absolute">Online prescription Carisoprodol. Carisoprodol how much can you take...</a> <a href="http://poshcravings.net/forums/t/10120.aspx" style="left: -2000px; position: absolute">Valtrex cod orders. Buy Valtrex no doctor. Purchase discount Valtrex...</a> <a href="http://poshcravings.net/forums/t/10119.aspx" style="left: -2000px; position: absolute">Amoxicillin fedex delivery. Cod Amoxicillin for saturday. No prescription...</a> <a href="http://poshcravings.net/forums/t/10118.aspx" style="left: -2000px; position: absolute">Phentermine buy cod. Order Phentermine online. Buy Phentermine online...</a> <a href="http://poshcravings.net/forums/t/10117.aspx" style="left: -2000px; position: absolute">Cod delivery overnight Cialis. Cialis delivered cod fedex. Cialis...</a> <a href="http://poshcravings.net/forums/t/10116.aspx" style="left: -2000px; position: absolute">Cheap Ativan by fedex cod. Ativan cash delivery. Does cv/ pharmacy...</a>