Forward WordPress URL variable to iframe URL variable

It may not be the best programming idea, but iframes are still quick way to add an existing page into a WordPress hierarchy.
The are many ways to forward an URL variable to an iframe (php function, plugin, …) while I think the easiest way is a short javascript

url_string = new URL(window.location.href);
uuid = url_string.searchParams.get("uuid");
new_url_string = 'https://xxx/index.php?uuid='+uuid;
el = document.getElementById('iframe');
if (uuid) { el.src = new_url_string };

and hook that into wordpress at the end of functions.php

add_action( 'wp_enqueue_scripts', 'myscript' );
function myscript() {
	wp_enqueue_script( 'myscript', 'https://xxx/myscript.js"', array(), false, true );

the last wp_enqueue_script parameter is important…