This could be causing some problems - I'm not sure it works like I originally thought it would.

It probably has to be more like:

`if ( (parsedUrl.protocol !== "http:") && ( (parsedUrl.protocol !== "https:") )  {`