Pot.js で利用可能。 PotLite.js では利用できません。
URI 文字列を解析します。
URI を解析し、各要素をもつオブジェクトを返します。
結果のオブジェクトのキー名は window.location の要素名を拡張したものです。
Pot.globalize() が適応されている場合、Pot.parseURI() が parseURI() で実行できます。
URI を解析したオブジェクトが返ります。
// // This results contains all the keys and values. // var uri = 'http://user:pass@host:8000/path/to/file.ext?arg=value#fragment'; var result = Pot.parseURI(uri); Pot.debug(result); // { // protocol : 'http:', // scheme : 'http', // userinfo : 'user:pass', // username : 'user', // password : 'pass', // host : 'host:8000', // hostname : 'host', // port : '8000', // pathname : '/path/to/file.ext', // dirname : '/path/to', // filename : 'file.ext', // extension : 'ext', // search : '?arg=value', // query : 'arg=value', // hash : '#fragment', // fragment : 'fragment' // }
var uri = 'file:///C:/foo/bar/baz.js'; var result = Pot.parseURI(uri); Pot.debug(result); // { // protocol : 'file:', // scheme : 'file', // userinfo : '', // username : '', // password : '', // host : '', // hostname : '', // port : '', // pathname : 'C:/foo/bar/baz.js', // dirname : 'C:/foo/bar', // filename : 'baz.js', // extension : 'js', // search : '', // query : '', // hash : '', // fragment : '' // }