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 7919811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:59:16+00:00 2026-06-03T15:59:16+00:00

Im pretty sure my syntax this wrong because the script only works if the

  • 0

Im pretty sure my syntax this wrong because the script only works if the string matches “Video”, if the string has the “word “Audio” it is ignored. Also since the href tags have a value of “#” the redirect for “../../../index.html” doesnt work.

js

var ua = navigator.userAgent.toLowerCase();
var isIE8 = /MSIE 8.0/i.test(ua);
if (isIE8) {
    $('a').click(function () {
        var srcTag = $(this).find('img').attr('src');
        if (srcTag.indexOf('Video' || 'Audio') > -1) {
            if (confirm('Download Safari? \n\n http://apple.com/safari/download/')) {
            window.location = 'http://apple.com/safari/download/';
            } else { window.location = '../../../index.html';}
        } else {
            alert('no match');
        }
    });
}

html

<a href="#"><img src="Video/000_Movies/assets/005_CCC_Jesus_Story_80x60.jpg" />test1</a> 
<a href="#"><img src="Audio/000_Movies/assets/006_GSP_Gods_Story_80x60.jpg" />test2</a> 
<a href="#"><img src="Media/000_Movies/assets/002_God_Man_80x60.jpg" />test3</a>
  • 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-06-03T15:59:19+00:00Added an answer on June 3, 2026 at 3:59 pm

    It’s far shorter to turn this into a regular expression.

    if ( srcTag.match( /(video|audio)/ ) ) {
      /* Found */
    } else {
      /* Not Found */
    }
    

    On a side note, please don’t do what you’re attempting to do. Asking users to download Safari when they’re using Internet Explorer 8 is doing a disservice to the Internet, as well as to that user.

    As for redirecting the domain to another location, you should use .preventDefault() to keep the browser from following the link:

    $("a.videoDownload").on("click", function(e){
      e.preventDefault();
      if ( this.getElementsByTagName("img")[0].src.match( /(video|audo)/ ) ) {
        window.location = confirm( 'Download Safari?' )
          ? "http://apple.com/safari/download" 
          : "../../../index.html" ;
      } else {
        /* No match */
      }
    });
    

    Again, please don’t actually do this. Nobody wants to be that guy, and when you tell users to download another browser, you’re being that guy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im pretty sure this has a simple solution. I am using jCarousellite, and i
This is a question about syntax more than anything. I am pretty sure that
I am pretty sure this is a basic syntax error, I am new at
I'm pretty sure this is possible, because I'm pretty sure I've seen it done.
my first time using one of these and I'm pretty sure this works as
Pretty sure there is an easy answer to this, but just can't find the
Pretty sure some people encountered this problem before. Followed all the instructions to setup
Am pretty sure this is a cake 1.3 question - the plugin is not
I'm pretty sure I've seen this somewhere, but I can't find the right terminology
I'm pretty sure there is no way, but i'm putting this out there for

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.