======================================================================================== Idea #1 ---------------------------------------------------------------------------------------- (Step 1) If a load event occur with loadidx==1, then it is the first GForm load. Do nothing. (Step 2) If a load event occur with loadidx==2, then it should be either reloading iframe or a form submition. (Step 3) Set iframe.src to the initial URL. If that was reloading iframe, then nothing should happen because it's the same URL. Set timeout for 1 sec, then close the GForm with submission flag = 0. If that was a form submition, then another load event with loadidx==3 will occur. If loadidx==3, then close GForm with submission flag = 1 ======================================================================================== In the above idea #1, the step 3 has a problem. It's assuming that if you set iframe.src to the same URL, the iframe does nothing. Actually it's wrong! Consider the following snipet. ---------------------------------------------------------------------------------------- let loadidx=0; el_iframe.addEventListener("load",function(){ el_iframe.src="form-001.php"; // Assign the same URL as the initial URL loadidx++; console.log("loadidx",loadidx); }); el_iframe.src="form-001.php"; ---------------------------------------------------------------------------------------- This code will get into an infinite loop because assigning the same URL will cause reloading! However, the following code will not get into an infinite loop. ---------------------------------------------------------------------------------------- let loadidx=0; el_iframe.addEventListener("load",function(){ el_iframe.src="form-001.php#abc"; loadidx++; console.log("loadidx",loadidx); }); el_iframe.src="form-001.php"; ---------------------------------------------------------------------------------------- The trick is appending fragments. In this case, the fragments are "#abc" ---------------------------------------------------------------------------------------- el_iframe.src="form-001.php#abc"; ---------------------------------------------------------------------------------------- ========================================== ==>The trick won't work on remote URL! ========================================== Suppose you set iframe to this URL ---------------------------------------------------------------------------------------- el_iframe.src="https://www.remote.com/test.php"; ---------------------------------------------------------------------------------------- Then set it to the URL with '#abc' ---------------------------------------------------------------------------------------- el_iframe.src="https://www.remote.com/test.php#abc"; ---------------------------------------------------------------------------------------- It will reload the entire page instead of just moving to '#abc' because "https://www.remote.com/test.php" is remote URL. It looks like there is no way to detect whether it's iframe reload or submitting. ======================================================================================== Then how about disabling the context menu so users can never reload the iframe? ==> Unfortunately, it's not possible to disable the context menu of an ifram that contains an external web page. ========================================================================================