Reputation: 943
For example, if in php i printed this:
<script type="text/javascript">
txt = "<p>Browser Name: " + navigator.appName + "</p>";
document.getElementById("example").innerHTML=txt;
</script>
and used a variable, lets say $bname
then used an if()
statement, could i change the value of an element such as a link <a>
etc. to whatever i wanted? alternatively is there a way in jQuery/JavaScript?
Upvotes: 4
Views: 68
Reputation: 461
You can easily achieve this on jQuery. Using jQuery.browser as easy as this example.
if ($.browser.webkit) {
//do stuff for webkit browsers
}
Upvotes: 2
Reputation: 20602
$_SERVER['HTTP_USER_AGENT']
may be used PHP side.
Alternatively, with jQuery, you can use the $.browser
flags.
Upvotes: 3