Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. OPerating system

OPerating system

Scheduled Pinned Locked Moved ASP.NET
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kibromg 0
    wrote on last edited by
    #1

    Hi all, I want to check the operating system of the user before i load the web page. Step 1 . I did insert the following into the tags of my page: <--> function checkOS() { if(navigator.userAgent.indexOf('IRIX') != -1) { var OpSys = "Irix"; } else if((navigator.userAgent.indexOf('Win') != -1) && (navigator.userAgent.indexOf('95') != -1)) { var OpSys = "Windows95"; } else if(navigator.userAgent.indexOf('Win') != -1) { var OpSys = "Windows3.1 or NT"; } else if(navigator.userAgent.indexOf('Mac') != -1) { var OpSys = "Macintosh"; } else { var OpSys = "other"; } return OpSys; } // --> </--> Step 2. I inserted the following anywhere inside the tags: <--> var OpSys = checkOS(); document.write(OpSys); //--> </--> However, Nothing comes up when i run the page? Regards kibrom

    S 1 Reply Last reply
    0
    • K kibromg 0

      Hi all, I want to check the operating system of the user before i load the web page. Step 1 . I did insert the following into the tags of my page: <--> function checkOS() { if(navigator.userAgent.indexOf('IRIX') != -1) { var OpSys = "Irix"; } else if((navigator.userAgent.indexOf('Win') != -1) && (navigator.userAgent.indexOf('95') != -1)) { var OpSys = "Windows95"; } else if(navigator.userAgent.indexOf('Win') != -1) { var OpSys = "Windows3.1 or NT"; } else if(navigator.userAgent.indexOf('Mac') != -1) { var OpSys = "Macintosh"; } else { var OpSys = "other"; } return OpSys; } // --> </--> Step 2. I inserted the following anywhere inside the tags: <--> var OpSys = checkOS(); document.write(OpSys); //--> </--> However, Nothing comes up when i run the page? Regards kibrom

      S Offline
      S Offline
      sathish s
      wrote on last edited by
      #2

      kibromg wrote:

      Step 2. I inserted the following anywhere inside the tags: <--> var OpSys = checkOS(); document.write(OpSys); //--> </-->

      You are using document.write inside a script. I guess it wont work. . Instead you can have a alert statement.

      kibromg wrote:

      <--> function checkOS() { if(navigator.userAgent.indexOf('IRIX') != -1) { var OpSys = "Irix"; } else if((navigator.userAgent.indexOf('Win') != -1) && (navigator.userAgent.indexOf('95') != -1)) { var OpSys = "Windows95"; } else if(navigator.userAgent.indexOf('Win') != -1) { var OpSys = "Windows3.1 or NT"; } else if(navigator.userAgent.indexOf('Mac') != -1) { var OpSys = "Macintosh"; } else { var OpSys = "other"; } <b>alert("OpSys");</b> return OpSys; } // --> </-->

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups