Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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

Posted on 2014-11-24
Medium Priority
Last Modified: 2014-11-24

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


<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");

Open in new window

Question by:smfmetro10
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
LVL 58

Accepted Solution

Gary earned 2000 total points
ID: 40463561

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

Author Closing Comment

ID: 40463572

Featured Post

Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

Question has a verified solution.

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

I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
The viewer will learn how to dynamically set the form action using jQuery.
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)

721 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