iframe_navigation.html (1268B)
1 <!DOCTYPE html> 2 <!-- Any copyright is dedicated to the Public Domain. 3 - http://creativecommons.org/publicdomain/zero/1.0/ --> 4 <html> 5 <head> 6 <meta charset="UTF-8"> 7 </head> 8 <body class="running"> 9 <script> 10 window.addEventListener("message", doNavigation); 11 12 function doNavigation() { 13 let destination; 14 let destinationIdentifier = window.location.hash.substring(1); 15 switch (destinationIdentifier) { 16 case "blank": 17 destination = "about:blank"; 18 break; 19 case "secure": 20 destination = 21 "https://example.com/browser/browser/base/content/test/siteIdentity/dummy_page.html"; 22 break; 23 case "insecure": 24 destination = 25 // eslint-disable-next-line @microsoft/sdl/no-insecure-url 26 "http://example.com/browser/browser/base/content/test/siteIdentity/dummy_page.html"; 27 break; 28 } 29 setTimeout(() => { 30 let frame = document.getElementById("navigateMe"); 31 frame.onload = done; 32 frame.onerror = done; 33 frame.src = destination; 34 }, 0); 35 } 36 37 function done() { 38 document.body.classList.toggle("running"); 39 } 40 </script> 41 <iframe id="navigateMe" src="dummy_page.html"> 42 </iframe> 43 </body> 44 </html>