File.prototype.prefixVar()

create a unique variable name for use in a URL.

Syntax

file.prefixVar(name string) string

Parameters

name string

Name of the variable to have prefixed.

Description

Create a namespaced request parameter for use in a URL.

The provided name is prefixed with a string unique to the file to be used in URL query parameters.

The purpose of prefixing variables is applying a namespace so that parameters can be passed to individual applications instead of all of them. This way there may be 2 instances of the same application on the same page without having conflicts.

It is guaranteed that calling .prefixVar() on two different files of the same website will return different results. Think of addressing the parameters to specific targets.

Examples

Creating 2 unique request parameters addressed to separate files.