Skip to content

Commit

Permalink
Use indexOf instead of startsWith
Browse files Browse the repository at this point in the history
  • Loading branch information
roryg committed Jul 7, 2015
1 parent 5019c41 commit 36e674e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion assets/js/scripts.js
Expand Up @@ -96,12 +96,13 @@ jQuery(function($) {

//if url starts with http:// and currentState.url starts with
// https://, replace the protocol in url
if(url.startsWith("http://"))
if (url.indexOf("http://", 0) === 0)
{
var urlNoProt = url.replace(/.*?:\/\//g, "");
var curProt = currentState.url.split("/")[0];
url = curProt + "//" + urlNoProt;
}

// If the requested url is not the current states url push
// the new state and make the ajax call.
if (url !== currentState.url.replace(/\/$/, "")) {
Expand Down

0 comments on commit 36e674e

Please sign in to comment.