SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru CompiledMonkey's Avatar
    Join Date
    Sep 2002
    Location
    Richmond, VA
    Posts
    975
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Include js file based on browser

    Any advice?

    Code:
     <html>
     	<head>
     		<title id="title" runat="server"></title>
     		<link rel="stylesheet" href="./style.css" type="text/css" />
     		
     		<script type="text/javascript">
     			browser = navigator.appName
     			
     			if( browser.indexOf("Netscape") != -1 ) // firefox, netscape, mozilla
     		    	document.write("<script language=\"javascript\" src=\"./js/downloads_ff.js\"></script>");
     			else if( browser.indexOf("Microsoft") != -1 ) // internet explorer
     		    	document.write("<script language=\"javascript\" src=\"./js/downloads_ie.js\"></script>");
     		</script>
     	</head>

  2. #2
    SitePoint Guru CompiledMonkey's Avatar
    Join Date
    Sep 2002
    Location
    Richmond, VA
    Posts
    975
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Figured it out, I wasn't escaping the slash from the script tag.


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
  •