-
-
Save chirag64/d9a209d3fe21929791ee to your computer and use it in GitHub Desktop.
This file contains 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
// var parser = document.createElement('a'); | |
// parser.href = "http://user:secretpassword@example.com:3000/pathname/?search=test#hash"; | |
// OR | |
var parser = new URL("http://user:secretpassword@example.com:3000/pathname/?search=test#hash"); | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" | |
parser.username // => "user" | |
parser.password // => "secretpassword" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment