Hey everyone, im beginning to learn javascript/c++ and programming in general, however I was trying to wrap my head around javascript today. I was wondering if anyone could explain to me how JavaScript can be used to display things differently in two different browsers?
Thanks for any help, helping me to understand this!
Javascript + browsers question
Started by psychological, Jan 22 2008 01:27 AM
2 replies to this topic
#1
Posted 22 January 2008 - 01:27 AM
|
|
|
#2
Posted 22 January 2008 - 04:27 AM
You determine which browser the user are running, and then you show something for the user if he uses a specific browser. There's tons of material on the net about determining browsers.
#3
Posted 27 January 2008 - 07:39 AM
Somthing like this allows you to detect the browser that is being used and display unique content depending on the browser.
<script>
var BrowserName = navigator.appName
if (BrowserName == "Netscape")
{
alert("Your using Netscape");
}
else
{
if (browserName == "Microsoft Internet Explorer")
{
alert("Your using IE");
}
else
{
alert("What ARE you browsing with here?");
}
}
</script>
<script>
var BrowserName = navigator.appName
if (BrowserName == "Netscape")
{
alert("Your using Netscape");
}
else
{
if (browserName == "Microsoft Internet Explorer")
{
alert("Your using IE");
}
else
{
alert("What ARE you browsing with here?");
}
}
</script>


Sign In
Create Account

Back to top









