Here’s a little node module I’ve rewritten from a PHP/JS Typo3-plugin for a Webflow Project:
You would initialise this using
var StickyParameters = require("./StickyParameters");
module.exports = new StickyParameters(
/**
* List of allowed parameters. Can be a comma-separated string or a plain array.
* @type String | Array
*/
["parameter1", "parameter2", ..., "starred"],
/**
* List of allowed domains. Domains not listed here will not have parameters passed.
* @type String | Array
*/
[
"myfilmfestival.com",
"myexternalsite.com/that-tracks-the-users-film-selection",
...
"tickets.myfilmfestival.com"
],
/**
* Pass parameters internally (within the current domain if whitelisted)
* @type boolean
* @default false
*/
true,
/**
* Pass parameters externally (to other domains if whitelisted)
* @type boolean
* @default false
*/
true,
/**
* Don't make internal links local by removing the base URL from the processed href
* (which is the default behaviour, pass "true" to deactivate)
* @type boolean
* @default false
*/
true
);
Transpiling the above using e.g. Browserify (oder Webkit, or another transpiler of your choice) and integrating the resulting script in your Webflow project will automatically append the keys and values of the whitelisted parameters to all whitelisted URLs on the current page, thus effectively passing these parameters on throughout your page.
Now you merely have to trigger appending ids when the star icon is clicked and reading the URL parameters (via window.location.search
for instance) on the list page.