Last active
April 21, 2020 13:49
-
-
Save NoNamePro0/90235465714e01b1f1c05b4c0813b592 to your computer and use it in GitHub Desktop.
Get Theme from URL Parameter and enable CSS theme
This file contains 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
var head = document.getElementsByTagName('HEAD')[0]; | |
const queryString = window.location.search; | |
const urlParams = new URLSearchParams(queryString); | |
const theme = urlParams.get('theme') | |
var link = document.createElement('link'); | |
link.rel = 'stylesheet'; | |
link.type = 'text/css'; | |
link.href = 'src/css/themes/' + theme + '.css'; | |
head.appendChild(link); | |
console.log(theme + " theme enabled!"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment