Browser support.

This commit is contained in:
Paulo Gustavo Veiga 2011-03-29 20:42:57 -03:00
parent f8fa8b2b37
commit ba2db11b0e
3 changed files with 24 additions and 41 deletions

View File

@ -39,16 +39,15 @@ public class UserAgent implements Serializable {
UserAgent opera = UserAgent.create("Opera/9.21 (Windows NT 5.1; U; en)"); UserAgent opera = UserAgent.create("Opera/9.21 (Windows NT 5.1; U; en)");
UserAgent firefox = UserAgent.create("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20050302 Firefox/1.9.6");
UserAgent firefox = UserAgent.create("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20050302 Firefox/1.9.6"); assert firefox.isBrowserSupported();
assert firefox.isBrowserSupported();
firefox = UserAgent.create("Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7 Creative ZENcast v1.02.08 FirePHP/0.0.5.13"); firefox = UserAgent.create("Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7 Creative ZENcast v1.02.08 FirePHP/0.0.5.13");
assert firefox.isBrowserSupported(); assert firefox.isBrowserSupported();
firefox = UserAgent.create("Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.8.0.12) Gecko/20070731 Ubuntu/dapper-security Firefox/1.5.0.12"); firefox = UserAgent.create("Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.8.0.12) Gecko/20070731 Ubuntu/dapper-security Firefox/1.5.0.12");
assert firefox.isBrowserSupported(); assert firefox.isBrowserSupported();
firefox = UserAgent.create("'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 firefox 2.0'"); firefox = UserAgent.create("'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 firefox 2.0'");
assert firefox.isBrowserSupported(); assert firefox.isBrowserSupported();
@ -57,8 +56,6 @@ public class UserAgent implements Serializable {
assert firefox.isBrowserSupported(); assert firefox.isBrowserSupported();
} }
@ -132,22 +129,19 @@ public class UserAgent implements Serializable {
// Explorer Parse ... // Explorer Parse ...
this.product = Product.EXPLORER; this.product = Product.EXPLORER;
this.hasGCFInstalled = productDetails.indexOf("chromeframe")!=-1; this.hasGCFInstalled = productDetails.indexOf("chromeframe") != -1;
} else if (userAgentHeader.indexOf("iCab") != -1 || userAgentHeader.indexOf("Safari") != -1) { } else if (userAgentHeader.indexOf("iCab") != -1 || userAgentHeader.indexOf("Safari") != -1) {
// Safari: // Safari:
//Formats: Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1 //Formats: Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1
//Chrome: //Chrome:
//Formats: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7" //Formats: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7"
String versionStr = ""; String versionStr = "";
if(userAgentHeader.indexOf("Chrome")!=-1) if (userAgentHeader.indexOf("Chrome") != -1) {
{
this.product = Product.CHROME; this.product = Product.CHROME;
versionStr = userAgentHeader.substring(userAgentHeader.indexOf("Chrome")+7,userAgentHeader.lastIndexOf(" ")); versionStr = userAgentHeader.substring(userAgentHeader.indexOf("Chrome") + 7, userAgentHeader.lastIndexOf(" "));
} } else {
else
{
this.product = Product.SAFARI; this.product = Product.SAFARI;
versionStr = userAgentHeader.substring(userAgentHeader.indexOf("Version")+8,userAgentHeader.lastIndexOf(" ")); versionStr = userAgentHeader.substring(userAgentHeader.indexOf("Version") + 8, userAgentHeader.lastIndexOf(" "));
} }
parseVersion(versionStr); parseVersion(versionStr);
@ -169,7 +163,7 @@ public class UserAgent implements Serializable {
// Remove gecko string // Remove gecko string
// Debian Firefox is remamed to iceweasel. // Debian Firefox is remamed to iceweasel.
productAddition = productAddition.replace("Iceweasel","firefox"); productAddition = productAddition.replace("Iceweasel", "firefox");
productAddition = productAddition.substring(productAddition.indexOf(' ') + 1); productAddition = productAddition.substring(productAddition.indexOf(' ') + 1);
@ -190,16 +184,14 @@ public class UserAgent implements Serializable {
} }
// Now, parse product version ... // Now, parse product version ...
if(prodDesc!=null) if (prodDesc != null) {
{
int sI = productAddition.indexOf(prodDesc) + prodDesc.length() + 1; int sI = productAddition.indexOf(prodDesc) + prodDesc.length() + 1;
int eI = productAddition.indexOf(' ',sI); int eI = productAddition.indexOf(' ', sI);
if(eI==-1) if (eI == -1) {
{
eI = productAddition.length(); eI = productAddition.length();
} }
final String productVersion = productAddition.substring(sI,eI); final String productVersion = productAddition.substring(sI, eI);
parseVersion(productVersion); parseVersion(productVersion);
} }
@ -331,15 +323,15 @@ public class UserAgent implements Serializable {
public boolean isBrowserSupported() { public boolean isBrowserSupported() {
// Is it a supported browser ?. // Is it a supported browser ?.
final UserAgent.Product product = this.getProduct(); final UserAgent.Product product = this.getProduct();
boolean result = product == UserAgent.Product.FIREFOX && ((this.isVersionGreatedOrEqualThan(1, 5) && this.getOs() != UserAgent.OS.MAC) || (this.isVersionGreatedOrEqualThan(3, 0) && this.getOs() == UserAgent.OS.MAC)); boolean result = product == UserAgent.Product.FIREFOX && this.isVersionGreatedOrEqualThan(3, 0);
result = result || product == UserAgent.Product.EXPLORER && this.isVersionGreatedOrEqualThan(7, 0) && this.getOs() == UserAgent.OS.WINDOWS; result = result || product == UserAgent.Product.EXPLORER && this.isVersionGreatedOrEqualThan(7, 0) && this.getOs() == UserAgent.OS.WINDOWS;
result = result || product == UserAgent.Product.OPERA && this.isVersionGreatedOrEqualThan(9, 2); result = result || product == UserAgent.Product.OPERA && this.isVersionGreatedOrEqualThan(9, 0);
result = result || product == UserAgent.Product.CHROME && this.isVersionGreatedOrEqualThan(7, 0); result = result || product == UserAgent.Product.CHROME && this.isVersionGreatedOrEqualThan(8, 0);
result = result || product == UserAgent.Product.SAFARI && this.isVersionGreatedOrEqualThan(3, 0); result = result || product == UserAgent.Product.SAFARI && this.isVersionGreatedOrEqualThan(5, 0);
return result; return result;
} }
public boolean needsGCF(){ public boolean needsGCF() {
final UserAgent.Product product = this.getProduct(); final UserAgent.Product product = this.getProduct();
return product == UserAgent.Product.EXPLORER && this.isVersionLessThan(9) && this.getOs() == UserAgent.OS.WINDOWS && !this.hasGCFInstalled; return product == UserAgent.Product.EXPLORER && this.isVersionLessThan(9) && this.getOs() == UserAgent.OS.WINDOWS && !this.hasGCFInstalled;
} }

View File

@ -11,19 +11,10 @@ WiseMapping is optimized for use with:
<ul> <ul>
<li>Internet Explorer 7.0 or greater</li> <li>Internet Explorer 7.0 or greater</li>
<li>Firefox 3.0 or greater</li> <li>Firefox 3.0 or greater</li>
<li>Opera 9.21 or greater</li> <li>Opera 11 or greater</li>
<li>Safari 5 or greater</li>
</ul> </ul>
<p style="font-weight:bold;">
We suggest Firefox for an optimal experience.
</p>
<p>
<a href="http://www.mozilla.com/en/firefox/" target="_blank"><img src="../images/firefox.gif"
alt="Get Firefox!" align="absmiddle"
border="0" height="48" width="143"></a>
</p>
</br>
<p> <p>
We are working to support more browser in the future. Stay tuned ! We are working to support more browser in the future. Stay tuned !

View File

@ -15,7 +15,7 @@
<ul> <ul>
<li>Links Between Nodes</li> <li>Links Between Nodes</li>
<li>FreeMind 0.9 Update</li> <li>FreeMind 0.9 Update</li>
<li>Pure HTML 5.0 Support</li> <li>Improved HTML 5.0 Support</li>
<li>Firefox 4.0 is officially supported</li> <li>Firefox 4.0 is officially supported</li>
</ul> </ul>
</div> </div>