Avatar of RBS
RBS
 asked on

Filter out older IE Browsers Problem

Hi:

I have an online course and am trying to prevent people with older IE browsers from ordering it.  

I have the following:

<!--[if gt IE 8]>
                @Html.MenuLink("Order Courses", "OrderCourses", "Register")
  <![endif]-->

Open in new window


I find that all this does is make the Order Courses menu item invisible on IE 10 and IE11.

Any suggestions greatly appreciated.

RBS
.NET Programming

Avatar of undefined
Last Comment
RBS

8/22/2022 - Mon
Dave Baldwin

'gt' means 'greater than'.  Try 'lt' which means 'less than'.
RBS

ASKER
No, the gt is correct.  I have an earlier bit of code that shows the the following message if the browser is less than IE 9:

<!--[if lt IE 9]>
        <div class="lowBrowserMessage">
            <div class="ie-lowerthan9">HDCOElearning.com requires Internet Explorer 9 or greater</div>
<![endif]-->

Open in new window


This code works fine.  I guess the problem with using gt is that while IE browsers may recognize the rule, all others see this block of code as a comment and so ignore it.

My problem is that I want all browsers to see the Order link except those that are IE and below 9

RBS
Dave Baldwin

That is correct.  Only IE will read either of those as a conditional directive.  All other browsers see it Only as a comment.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
RBS

ASKER
Can you suggest any way that I can make it so that any browser other than id browsers below  9 can see the Order Link?
ASKER CERTIFIED SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
RBS

ASKER
I guess I will have to look at another method other than Conditional Comments - just wondering if you had any suggestions.
Dave Baldwin

Nothing easy.  The standard javascript methods don't report the info you're looking for.  This site lists the "User-Agent" strings for many browsers: http://www.useragentstring.com/pages/useragentstring.php
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
RBS

ASKER
Thanks Dave

RBS