Skip to content

Instantly share code, notes, and snippets.

@lijie2000
Forked from jlong/uri.js
Created April 29, 2014 15:38

Revisions

  1. @jlong jlong revised this gist Apr 21, 2012. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions uri.js
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,9 @@ var parser = document.createElement('a');
    parser.href = "http://example.com:3000/pathname/?search=test#hash";

    parser.protocol; // => "http:"
    parser.host; // => "example.com"
    parser.hostname; // => "example.com"
    parser.port; // => "3000"
    parser.pathname; // => "/pathname/"
    parser.search; // => "?search=test"
    parser.hash; // => "#hash"
    parser.hash; // => "#hash"
    parser.host; // => "example.com:3000"
  2. @jlong jlong created this gist Apr 20, 2012.
    9 changes: 9 additions & 0 deletions uri.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    var parser = document.createElement('a');
    parser.href = "http://example.com:3000/pathname/?search=test#hash";

    parser.protocol; // => "http:"
    parser.host; // => "example.com"
    parser.port; // => "3000"
    parser.pathname; // => "/pathname/"
    parser.search; // => "?search=test"
    parser.hash; // => "#hash"