queryStringParameter( )
Studio is being deprecated, please head over to the documentation page for Mattercraft, our most advanced 3D tool for the web, where you can find the most recent information and tutorials.
queryStringParameter(param: string): (undefined|string[]);
Returns
Section titled “Returns”An array of decoded string values for a given parameter from the query string passed in a deep link.
The query string is everything after the ?
character.
Default value: undefined
An unmodified form of the original query string is available by calling queryStringRaw( ) though this method is recommended.
Example
Section titled “Example”Assuming the deep link zappar://ZID?myname=Zap%20Bot&myfriend=Mark&myfriend=Connell
launched this experience with ZID
being the deep link of this experience we can access the query string as follows:
// Get the parameters we passed into the query stringlet name = Z.device.queryStringParameter("myname");let friends = Z.device.queryStringParameter("myfriend");
// Check the value returned exists and isn't emptyif (name && name.length > 0) { // Store the first element of the returned array let myname = name[0]; // myname holds the value 'Zap Bot'}
if (friends && friends.length > 0) { // Store the entire Array let myfriends = friends; // myfriends holds the value ['Mark', 'Connell']}