Restrict code in the templates to certain browsers.
by
09 Feb 2006
This thread will teach you how to restrict code in the templates to certain browsers. Before we begin This method is not a substitute for proper html and css. Also the way we determine the browser the client is using can easily be spoofed, it's not hard to make vBulletin think firefox is really IE for example. In other words this method should only be used when there is no other way to get the job done. The good stuff There is a function within the vBulletin source code call is_browser. With this function we can determine what type of browser the client is using, and which version of the browser the client is using. In any given template, you can use this code to display a short message to clients that use Internet Explorer: HTML Code:
<if condition="is_browser('ie')"><b>You are using Internet Explorer</b></if> HTML Code:
<if condition="is_browser('ie', 6)"><b>You are using Internet Explorer version 6</b></if> <if condition="is_browser('ie', 5)"><b>You are using Internet Explorer version 5</b></if> HTML Code:
<if condition="!is_browser('ie', 6)"><b>mysite.com only supports Internet Explorer 6.0 and higher, please upgrade your browser</b></if> Here is a list of browsers supported by the is_browser function. The call sign is on the left (the name you should use in the function call), the browser name that call sign relates to is on the right. Supported browsers opera => http://www.opera.com/ ie => http://www.microsoft.com mozilla => http://www.mozilla.org/products/mozilla1.x/ and Mozilla based browsers. firebird => Older versions of Firefox (below) firefox => http://www.mozilla.com/firefox/ camino => http://www.mozilla.org/products/camino/ konqueror => http://www.konqueror.org/ safari => http://www.apple.com/safari/download/ webkit => http://webkit.opendarwin.org/ based applications webtv => http://developer.msntv.com/Tools/WebTVVwr.asp netscape => http://browser.netscape.com/ |
Similar Mods
Restrict [code] and [php] to registered members only | vBulletin 2.x Full Releases |