Solved

how do you check a url and make it case insensitve?

Posted on 2014-11-24
2
82 Views
Last Modified: 2014-11-24
hHi,

I have a function that checks a url and see if it contains specific characters.  My problem is that sometimes the url is in uppercase and some times  its in lower case.

Is it possible to have the function case insensitive?

This is what I have so far

Thanks

<script type="text/javascript">
        $(document).ready(function () {
  var url = window.location.href;
if (url.indexOf("id_")>-1 || url.indexOf("con_id_") > -1)
{
  var num = url.replace("con_id","").replace("id_","");
  alert("Found it");
  alert(num);
}
		});
    </script>

Open in new window

0
Comment
Question by:smfmetro10
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40463561
Use

var url = window.location.href.toLowerCase();
0
 

Author Closing Comment

by:smfmetro10
ID: 40463572
Thanks!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to install NodejS to run a JavaScript application 3 32
How can I echo a PHP variable in AJAX function? 7 55
Wordpress Taxonomy 2 28
add a 3rd selection to sum 7 27
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question