UNPKG

mz700-js

Version:
34 lines (33 loc) 918 B
<!DOCTYPE html> <html> <script> function clientPull(table) { let pathname = window.location.pathname; let redirect_table = {}; Object.keys(table).forEach( urlTo => { table[urlTo].forEach( urlFrom => { redirect_table[urlFrom] = urlTo; }); }); if(pathname in redirect_table) { let host = window.location.host; let protocol = window.location.protocol; let urlhead = protocol + "//" + host; let redirectTo = urlhead + redirect_table[pathname]; console.log("clientPull redirectTo:", redirectTo); window.location.href = redirectTo; } } clientPull({ // Redirection on github.io (pulished gh-pages) "/mz700-js/emu": [ "/mz700-js/MZ-700/client", "/mz700-js/MZ-700/client.html", ], // Redirection on local web server "/emu.html": [ "/MZ-700/client.html", ], }); </script> </html>