Welcome To Snipplr
Everyone's Recent JavaScript Snippets Tagged url
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Function enables the reading of url appended variables. See URL for more information.
0
935
posted 11 years ago by gromitski
Works in SP2013 (and I believe 2010). Provides site collection URL without trailing "/"
0
975
posted 11 years ago by rumremix
This snippets show how to extract the video id of a youtube video from its URL
0
1108
posted 11 years ago by slimITTN
Code from https://snipt.net/geekyjohn/get-url-param/ updated so that most jslint issues are resolved, and updated the return to use a guard condition instead of a separate if statement.
1
1226
posted 12 years ago by pmw57
//You cannot change the whole url without redirecting, what you can do instead is change the hash.
//The hash is the part of the url that goes after the # symbol.
//That was initially intended to direct you (locally) to sections of your HTML doc...
0
913
posted 12 years ago by dnnsldr
This will return the value of "param" form the URI. For example if you have
www.example.com/index.html?param=some_value
it will return "some_value".
NOTE! This only works if you use Prototype JavaScript framework.
0
873
posted 12 years ago by srka
(I did not write this, but I forgot where I got it.)
This code will find all the variables passed though the URL and return the one you are looking for.
0
752
posted 13 years ago by sicbot
I found some cases where JavaScript won't properly handle the Plus symbol (+)
0
881
posted 13 years ago by Jamie
Usage:
Let's say we have an url: http://primera.vremenno.net?foo=yes&bar=no
var hash = getUrlVars();
alert(hash['foo']); // returns 'yes'
alert(hash['bar']); // returns 'no'
0
1024
posted 13 years ago by a1ias
given a url:
>`http://www.someurl.com/page.html?param1=foo¶m2=bar`
You can use map.param1 outside of the function such as:
>`$('#some_hidden_field').val(map.param1);`
0
624
posted 13 years ago by agdm
Modified regex of URL Matcher found on http://daringfireball.net/2010/07/improved_regex_for_matching_urls
0
700
posted 13 years ago by naren1012
Hopefully this covers just about everything. This code has far more lines than htmlify.js but seems to work ok.
(I just remembered that " // Loop through the clear text " has no loop breaker - will post a fix, but it's not a show-stopper for mo...
0
1201
posted 13 years ago by jm1248
* example: google.com/reader/view/
folder = /reader
* example: google.com/reader
folder = /
* example: google.com
folder = ''
0
958
posted 13 years ago by markux
I did not, in fact write this script. I found it here:
http://www.webtoolkit.info/javascript-url-decode-encode.html
0
687
posted 13 years ago by racl101
A short photo id is a base58 conversion of the photo id. Base58 is like base62 [0-9a-zA-Z] with some characters removed to make it less confusing when printed. (namely 0, O, I, and l).
So that leaves an alphabet of: 123456789abcdefghijkmnopqrstuvw...
0
809
posted 15 years ago by loucypher
Read a page's GET URL variables and return them as an "associative array."
Calling the function while at `example.html?foo=asdf&bar=jkls` sets `map['foo']='asdf'` and `map['bar']='jkls'`
17
6104
posted 15 years ago by the_coder