Solved

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

Posted on 2014-11-24
2
89 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Report: Liquid Web beats Amazon, Rackspace & More

A study by performance analyst firm Cloud Spectator finds that Liquid Web beats rivals Amazon, Rackspace and DigitalOcean when it comes to website and cloud application performance.

Question has a verified solution.

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

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
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…

710 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