0

I have a question on how I can achieve a certain functionality based on the query string in the URL. When the user enters www.example.com?view=list I want to default the tab to be the list view only when that query string is entered in the URL. The functionality of list view vs map view is already working and is currently regulated by tabs. Does anyone know how this can be achieved using JavaScript?

I wrote something like this, but it doesn't work.

onURL:function(e) {
    var url = document.location.href;
    if (url.indexOf('http://www.example.com?view=list') >= 0) {
        this.$("#mapButton").addClass ('selected');
        this.$("#listView").show ();
        this.$("#mapView").hide ();
    } 
},

0 Answers0