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.
------------------------------