Created
February 28, 2023 16:49
-
-
Save MikeNGarrett/7d85c536369e8b9e7689e2072f15327e to your computer and use it in GitHub Desktop.
Conditionally changing script src
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Test</title> | |
</head> | |
<body> | |
<script type="module"> | |
const condition = window.location.host == 'apexofacircle.github.io'; | |
await import(condition ? '/GithubShop/script.js' : '/script.js') | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment