RuKoder.ru RUKODER.ru
13 НОЯ 2012
0

js-url - простой, легкий парсер url на js

JavaScript
http://rob:[email protected]/path/index.html?query1=test&silly=willy#test=hash&chucky=cheese
url();            // http://rob:[email protected]/path/index.html?query1=test&silly=willy#test=hash&chucky=cheese
url('domain'); // example.com
url('hostname'); // www.example.com
url('tld'); // com
url('sub'); // www
url('.0') // (an empty string)
url('.1') // www
url('.2') // example
url('.-1') // com
url('auth') // rob:abcd1234
url('user') // rob
url('pass') // abcd1234
url('port'); // 80
url('protocol'); // http
url('path'); // /path/index.html
url('file'); // index.html
url('filename'); // index
url('fileext'); // html
url('1'); // path
url('2'); // index.html
url('3'); // (an empty string)
url('-1'); // index.html
url(1); // path
url(2); // index.html
url(-1); // index.html
url('?'); // query1=test&silly=willy
url('?silly'); // willy
url('?poo'); // (an empty string)
url('#'); // test=hash&chucky=cheese
url('#chucky'); // cheese
url('#poo'); // (an empty string)

https://github.com/websanova/js-url

Добавить комментарий

Категории:

  • CSS (121)
  • PHP (301)
  • JavaScript (704)

Оставить на заметку в:

© 2026 RuKoder.ru