{extends "[shared]/window/users.tpl"}

<script type="text/javascript">
   {block onready append}
   $(function () {
      if (typeof BroadcastChannel === 'undefined') {
         return;
      }
      const search = new URLSearchParams(window.location.search);
      if (!search.get('ID')) {
         return;
      }

      window.addEventListener('beforeunload', function () {
         const channel = new BroadcastChannel('pos:load-new-user');
         channel.postMessage(search.get('ID'));
         channel.close();
      });
   });
   {/block}
</script>
