Created
May 16, 2012 20:01
-
-
Save sleekslush/2713507 to your computer and use it in GitHub Desktop.
HTTP protocol logic in javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Stupid as shit | |
var url = (("https:"==document.location.protocol)?"https":"http") + "://domain.com/file.js"; | |
// Better | |
var url = document.location.protocol + "//domain.com/file.js"; | |
// Best (protocol-less FTW!) | |
var url = "//domain.com/file.js"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment