Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-11-24
2
Medium Priority
?
97 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 2000 total points
ID: 40463561
Use

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

Author Closing Comment

by:smfmetro10
ID: 40463572
Thanks!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn how to dynamically set the form action using jQuery.
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…
Suggested Courses

783 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