I figured out that I can use window.location.href
to check for the existence of the hash tag appended to the url. So I use window.onload
to check for a hashtag in the url, and doGet(e)
to check for string attachments to the URL. I need to run both.
<script>
//Script tag in first HTML file that always loads
window.onload=function(){
console.log("This onload did run");
//get the URL out of the browsers address bar
//the URL can have multiple different strings attached depending upon the situation.
//Any situation other than something with a hashtag is initiated in the back end.
window.daURLhash = window.location.hash;
console.log('daURLhash: ' + daURLhash);
window.urlHash = daURLhash.toString();
console.log('urlHash: ' + urlHash);
console.log("url: " + urlHash);
//If a certain situation, there will be a hashtag in the url string
if (urlHash != undefined && urlHash != null) {
if (urlHash.length > 0) {
window.hashExist = true;
console.log('hashExist: ' + hashExist);
};
};
if (window.hashExist === true) {
code here
</script>