www.webdeveloper.com
Results 1 to 5 of 5

Thread: regular expression to replace html depending on browser

Hybrid View

  1. #1
    Join Date
    May 2012
    Posts
    1

    regular expression to replace html depending on browser

    I want to change my html depending on what browser the user is using.
    I know the regular expression works as I've tested it endlessly.
    Can anyone help?
    Here is the code

    <script language="JavaScript"
    type="text/JavaScript">
    if(navigator.appName == "Microsoft Internet Explorer")
    {
    function replaceit(s) {
    s.replace(/.*data=\"(.+?).svg".*/g, " <!-- end .content --> <div class=\"content\" style=\"text-align: center;height: 1000px;\"><img src=\"$1.html\" width=\"1104\" height=\"111\" alt=\"Gastroenterology Book\" /></div>"); }

    }
    </script></head>

  2. #2
    Join Date
    May 2006
    Location
    Somewhere behind your screen
    Posts
    1,633
    try to place this script in the body not in the head
    xxx: Guess Buddhist riddle: "What is the sound of one hand clapping?"
    yyy: facepalm

  3. #3
    Join Date
    Aug 2007
    Posts
    3,767
    To hit Internet Explorer reliably, you can use conditional expressions. Any other attempt to identify browser could be a failure.
    Great wit and madness are near allied, and fine a line their bounds divide.

  4. #4
    Join Date
    Feb 2012
    Location
    Bokaro Steel City (Jharkhand), India!
    Posts
    194
    Use IE conditional comments instead!
    "It will never rain roses: when we want to have more roses, we must plant more roses." - George Eliot

  5. #5
    Join Date
    Feb 2012
    Location
    Bokaro Steel City (Jharkhand), India!
    Posts
    194

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles