Skip to content
Related Articles

Related Articles

p5.js | getURLParams() Function

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 17 Jan, 2020

The getURLParams() function is used to return the current URL parameters a JavaScript object, with each parameter as a separate member of the object.



Parameters: This function does not accept any parameters.

Return Value: It returns an Object of the path parameters.

Below example illustrates the getURLParams() function in p5.js:


function setup() {
  createCanvas(500, 200);
  // get the url path as array
  urlParamsObject = getURLParams();
    10, 20);
  text("The URL parameters are: ", 10, 60);
  text("Type parameter: " + urlParamsObject["type"], 10, 80);
  text("Height parameter: " + urlParamsObject.height, 10, 100);
  text("Width parameter: " + urlParamsObject.width, 10, 120);
  // display the array in the console


  • Displaying the properties of the object:
  • Viewing the object in the console:

Online editor:
Environment Setup:


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!