jqURL is a plugin for the jQuery javascript library. It allows you to do some stuff to and with urls and windows/iframes that can decrease your js footprint. Below are the public functions available, along with some demos for each.
returns the whole url string - like win.location.href
kinda useless but I use it internally a lot
so if the current window href is "http://www.mysite.com?var1=1&var2=2&var3=3"
$.jqURL.url() returns "http://www.mysite.com?var1=1&var2=2&var3=3"
- locates passed in window to urlstr, which is required
- works like window.location.href = 'myurl'
- but you can also use it to pop open a new window by passing in "_blank" as the wintype
- if popping open a window, defaults to center of screen, and 500x500 pixels
so
$.jqURL.loc('http://www.google.com',
{w:200,h:200,wintype:'_blank'});
would open Google in a new centered 200x200 window
or, locate an url to any named window:
$.jqURL.loc('http://www.google.com',{ win:mywindow });
opens Google in mywindow
returns querystring, either string (pass ret:'string' [default])
or object (pass ret:'object')
if passed with no arguments, returns url with '?' and query string removed
if you pass in list of keys, it returns url with the specified key-value pairs removed
so if the current window href is "http://www.mysite.com?var1=1&var2=2&var3=3"
$.jqURL.strip();
will return
"http://www.mysite.com"
$.jqURL.strip({ keys:'var1,var2' });
will return
"http://www.mysite.com?var3=3"
returns value of passed in querystring key
so if the current window href is "http://www.mysite.com?var1=1&var2=2&var3=3"
$.jqURL.get('var2');
will return 2
returns the window's url, but with the key/value set in the query string
if the key already exists, re-sets the value
if it doesn't exist, it's appended onto the query string