?
Solved

window location ToUpper ??

Posted on 2011-10-19
3
Medium Priority
?
244 Views
Last Modified: 2012-05-12
$(document).ready(function ()
{
    var loc = window.location.href;

    if (loc.indexOf("CourseSearch.aspx") != -1)
    {
        alert("on coursesearch page");
    }
});

Right now this only works if the page name is "CourseSearch"

I need it to work as long as the letters are in the right sequence, regardless of case.

coursesearch
Coursesearch
CourseSearch
courseSearch
COUrsesearch
coursesearchH

all are valid names for the same page
0
Comment
Question by:Tom Knowlton
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 36996569
$(document).ready(function ()
{
    var loc = window.location.href;

    if (loc.toLowerCase().indexOf("coursesearch.aspx") != -1)
    {
        alert("on coursesearch page");
    }
});
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 36996579
Thanks!


I could not remember the name of the function...

$(document).ready(function ()
{
    var loc = window.location.href.toUpperCase();

    alert(loc);

    if (loc.indexOf("COURSESEARCH") != -1)
    {
        alert("on coursesearch page");
    }
});

Open in new window

0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 36996582
It works.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
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 …
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

862 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