Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6931235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:33:02+00:00 2026-05-27T11:33:02+00:00

I have a link to a script in the head section of my page

  • 0

I have a link to a script in the head section of my page in the traditional format, i.e.

<script src="scripts/scriptname.js" type="text/javascript"></script>

I would like to prevent this script loading in IE8 and earlier and also on iPhones/iPads and mobile devices in general.

I have this statement for preventing it running in IE8, but I am not sure how to adapt this to include earlier versions of IE as well, and I am also not sure about mobile devices:

<!--[if !IE 8]><!-->
    <script src="scripts/scriptname.js" type="text/javascript"></script>
<!--<![endif]-->

Could someone help with this?

Thanks,

Nick

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:33:03+00:00Added an answer on May 27, 2026 at 11:33 am
    <!--[if lt IE 9]>
         <script src="scripts/scriptname.js" type="text/javascript"></script>
    <![endif]-->
    

    this will include the block for Internet Explorer 8 and lower ( lt = less than ).

    But – if you have to adapt the script just for mobile devices too, i think a javascript solution is the best.
    Check the user agent by the navigator object for browser and device, like this:

    if( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || ... )
    

    Include all mobile devices can be too much. Switch by the screen size is a good way:

    if ( screen.width <= 699 ) {
         // your script
    }
    

    with browser detection for finding MSIE but not 9.0:

    if ( screen.width <= 699 || navigator.userAgent.match(/MSIE\s(?!9.0)/) ) {
         // your script
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following file file: <html> <head> <title></title> <script type=text/javascript src=/Prototype.js></script> <script type=text/javascript>
I have this script $('head').append('<link rel=stylesheet href=css/file1.css type=text/css />'); $('head').append('<link rel=stylesheet href=css/jquery.jscrollpane.css type=text/css />');
Suppose I have following html page. <html> <head> <link type=text/css rel=Stylesheet href=css/some.css /> </head>
I have a layout page thusly <!DOCTYPE html> <html> <head> <title>@ViewBag.Title</title> <script src=@Url.Content(~/Scripts/jquery-1.7.1.min.js) type=text/javascript></script>
I have the following in the section of my page: <head> <link rel='stylesheet' href='style.css'
I have a link to a page which invokes the 'Sexy Alert Box' script
I have a script which collects an image, link and some text content from
I have this code in my master page in the head section: <head runat=server>
I have a <base> tag as below in <head> section of the page: <base
I have a small script where you can drag the link, but I also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.