Results 1 to 6 of 6

Thread: Image Maps and Browser Detection of JScript

  1. #1
    Join Date
    Nov 2009
    Posts
    75

    Image Maps and Browser Detection of JScript

    I have finished studying HTML(Hyper Text Markup Language) last month. And now I am studying JScript. Although uptill now everything was not quite easy untill I reached the JScript Advanced part. Now can anyone define and provide information on Image Maps and Browser Detection in JScript. I am finding this section little difficult to understand.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    JavaScript: Navigator object

    There are certain old browsers which may not compatible with JavaScript. In such situation is wise enough to detect whether a browser will support the JavaScript web page or not. For this we make use of the Navigator object. The visitor's browser information is contained in the Navigator object. Thus we can use the Navigator object in JavaScript to detect the user's Web browser.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    JavaScript: Browser Detection.

    Code:
    <html>
    <head>
    <script type="text/javascript">
    function detectBrowser()
    {
    var wb=navigator.appName;
    var wbver=navigator.appVersion;
    var ver=parseFloat(wbver);
    if ((wb=="Netscape"||wb=="Microsoft Internet Explorer IE")
      && (ver>=4))
      {
      alert("This Browser is supported");
      }
    else
      {
      alert("Update your browser");
      }
    }
    </script>
    </head>
    
    <body onload="detectBrowser()">
    </body>
    </html>
    The above code is used to provide the user with the information whether the web browser used by the user is supported or not. The Scripting language used is JavaScript.

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    HTML Image Map Code

    Code:
    <html>
    <head>
    <script type="text/javascript">
    function writeText(txt)
    {
    document.getElementById("desc").innerHTML=txt;
    }
    </script>
    </head>
    
    <body>
    <img src="Byke.gif" width="70" height="115"
    alt="Planets" usemap="#Bykemap" />
    
    <map name="Bykemap">
    <area shape ="rect" coords ="0,0,60,100"
    onMouseOver="writeText('Harley Davidson')"
    href ="harley.htm" target ="_blank" alt="Harley" />
    
    <area shape ="circle" coords ="70,40,3"
    onMouseOver="writeText('V-Twin Engine')"
    href ="vtwin.htm" target ="_blank" alt="Engine" />
    
    <area shape ="circle" coords ="99,30,4"
    onMouseOver="writeText('Willy G. Davidson')"
    href ="Willy.htm" target ="_blank" alt="Willy" />
    </map>
    
    <p id="desc"></p>
    
    </body>
    </html>
    The above code is what I used for scripting an HTML page with JavaScript when I was given an assignment. I used the Harley Davidson byke as the image for my Image Map.

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    Browser Detection with navigator.appVersion objects and navigator.appName.

    Incase you want to know which web browser the user of your web site is using to view your web site's web page then you may use the Browser Detection using the J-Script. At the same time you can even send a welcome message to the user with the web browser name. For this you may use:
    • navigator.appVersion object- To display your message.
    • navigator.appName object- To get the Web browser's Name.

  6. #6
    Join Date
    Feb 2008
    Posts
    1,852

    Browser Detection in JavaScript

    We can easily code a HTML page using JavaScript to detect the web browser with the help of Navigator Object.
    Code:
     <script type="text/javascript">
    function GetVersion()
    {
    var bwrn = navigator.appName
    var bwrv = navigator.appVersion
    var text =""
    text += '
    
    Your Web Browser is: '
    text += bwrn +' '+ bwrv
    text += '</P>'
    document.write(text)
    }
    </script>
    You may use the following Navigator objects:
    navigator.platform, navigator.appVersion, navigator.appCodeName and navigator.appName.

Similar Threads

  1. Image browser performance on Honeycomb tabletpc
    By AdaraKhan in forum Portable Devices
    Replies: 7
    Last Post: 27-10-2011, 12:44 PM
  2. Google Maps crashes on Safari 5.0.1 browser
    By Cassius Marcellus in forum Technology & Internet
    Replies: 3
    Last Post: 13-11-2010, 05:16 PM
  3. Scripting photoshop image browser
    By Ashlee_Techi in forum Windows Software
    Replies: 3
    Last Post: 30-06-2010, 05:00 PM
  4. How to view maps and get directions in Chrome browser?
    By Coreey in forum Technology & Internet
    Replies: 5
    Last Post: 11-03-2010, 09:04 AM
  5. Firefox browser not showing any image or pictures
    By Rahman Khan in forum Technology & Internet
    Replies: 3
    Last Post: 11-05-2009, 10:38 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,026,537.97160 seconds with 17 queries