I'm not a JavaScript expert, but think the difference it that the original code sets the new URL once the page has been loaded (AddLoadEvent triggers the code in the function once the page is fully loaded); and I think your abbreviated version may load/execute while the code is read. Which in this case may not be an issue, but may not be considered good coding. The { } are part of that AddLoadEvent construct, so if you remove that, it doesn't surprise me that you don't need it.
If there are JavaScript experts, please chime in.
On the <!-- comment -->, that is done for browsers that don't support JavaScript. Those (old, possibly text based) will print out text in tags that are not understood.
Please test with many different devices if this does what you want it to do, and there is many crappy JavaScript code out there that works but may not be conform best coding practices.
------------------------------
Herman Robers
------------------------
If you have urgent issues, always contact your Aruba partner, distributor, or Aruba TAC Support. Check
https://www.arubanetworks.com/support-services/contact-support/ for how to contact Aruba TAC. Any opinions expressed here are solely my own and not necessarily that of Hewlett Packard Enterprise or Aruba Networks.
------------------------------
Original Message:
Sent: May 05, 2021 06:35 AM
From: Derin Mellor
Subject: CPG Login receipt automatic jump to another page
The official way to skip over the receipt page and presnet the login page is described here: https://community.arubanetworks.com/browse/articles/blogviewer?blogkey=758fff81-4ecb-435d-bfc6-70567c73df66
On my ClearPass running 6.9.5 I'm creating a conference enrolment (login) with subsequent attendee registration. I want to jump from the conference enrolment (called the Login Message) to the attendee registration page. The above technote implies I should be possible using the javascript:
<script type="text/javascript"><!--
addLoadEvent(function() {ldelim}
window.location.href='guest_registration.php';
{rdelim});
//-->
</script>
But this does not work.
If I remove the addLoadEvent(function() and ); ie:
<script type="text/javascript"><!--
{ldelim}
window.location.href='guest_registration.php';
{rdelim}
//-->
</script>
Then it works.
Why is this?
This was tested on FFv88.0
I can also remove the HTML comments (<!-- and -->) though not sure why these are in here?
I can also remove Smarty delimiter tag ({ldelim} and {rdelim}), I believe these are used to escape any characters { and } but as I don't have any they seem redundant?
Ultimately I can get this down to:
<script type="text/javascript">
window.location.href='guest_registration.php';
</script>
Thoughts?
------------------------------
Derin Mellor
------------------------------