getparameterbyname

1.0.3 • Public • Published

getParameterByName

Build Status

Stackoverflow answer packaged as NPM package.

Usage

Use in browser

<script src="https://unpkg.com/getparameterbyname/dist/bundle.min.js"></script>

<script>
  const url = 'https://www.example.com/search?q=nodejs';

  const queryParameterValue = getQueryParameterByName('q', url);

  // Print queryParameterValue to console
  console.log(queryParameterValue);
</script>

Get query parameter from url

import getQueryParameterByName from 'getqueryparameterbyname';

const url = 'https://www.example.com/search?q=nodejs';

const queryParameterValue = getQueryParameterByName('q', url);

If no second parameter is set, window.location.href is used.

Readme

Keywords

none

Package Sidebar

Install

npm i getparameterbyname

Weekly Downloads

2

Version

1.0.3

License

CC-BY-SA-3.0

Unpacked Size

7.04 kB

Total Files

14

Last publish

Collaborators

  • theel0ja