Giter VIP home page Giter VIP logo

jquery-url's Introduction

$.url()

A simple, lightweight url parser for jQuery (~1.2 Kb minified, ~0.5Kb gzipped).

Examples

http://www.domain.com/path/index.html?query1=test&silly=willy#test=hash&chucky=cheese
$.url();            // http://www.domain.com/path/index.html?query1=test&silly=willy#test=hash&chucky=cheese
$.url('domain');    // www.domain.com
$.url('host');      // domain.com
$.url('tld');       // com
$.url('sub');       // www
$.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('?');         // 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)

We can also pass a url in and use all the same options on it:

$.url('sub', 'test.www.domain.com/path/here');               // test.www
$.url('protocol', 'www.domain.com/path/here');               // http
$.url('path', 'http://www.domain.com:8080/some/path');       // /some/path
$.url('port', 'http://www.domain.com:8080/some/path');       // 8080
$.url('protocol', 'https://www.domain.com:8080/some/path');  // https
etc...

Resources

License

MIT licensed

Copyright (C) 2011-2012 Websanova http://www.websanova.com

jquery-url's People

Contributors

websanova avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.