How to get URL Parameters into HTML Canvas?
Copy link to clipboard
Copied
Here's a javascript function that reads the URL parameters and makes them usable for javascript. How can I adapt this for use inside a HMTL Canvas in Adobe Animate? I have tried unsuccessfully.
function GetURLParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}​
// Retrieve Parameters and set Variables
var lab = GetURLParameter('lab');
var sec = GetURLParameter('sec');
Help much appreciated. I'm new to Animate, and have been searching for the solution.
Cheers,
Geoff
Copy link to clipboard
Copied
Hi Geoff
I've attached an FLA that shows how your code can be used to populate a dynamic text box with URL parameters in Animate HTML5.
Hope it helps! Let me know if you have any questions.
Copy link to clipboard
Copied
"I have tried unsuccessfully" is a completely useless statement for troubleshooting. Have you checked the browser's dev console for errors? Is the function even running? Is it crashing? Is it returning the wrong values? Unexpected values? Any values at all?

