0

I have the following javascript in my HTML:

<script> 
// This is not needed when the the style is set in _layouts/base.html 
// document.body.style.visibility = 'hidden'; 
function makeBodyVisible() { document.body.style.visibility = 'visible'; } if (window.addEventListener) window.addEventListener("load", makeBodyVisible, false); 
else if (window.attachEvent) window.attachEvent("onload", makeBodyVisible); 
else window.onload = makeBodyVisible; 
</script> 

However, when the page is loaded it remains hidden. I've also inspected whether the window.onload or any of the other event listeners are created (using getEventListeners) and none is. This leads me to believe the script is not run. Strangely enough, this happens only on my github.io page while locally it does. Could someone suggest me what is going on? Here is the website: https://botev.github.io/

2
  • Did you configure your repository properly? Is your index.html in the root directory of your project ? Commented Mar 19, 2018 at 15:16
  • I do believe it is correct. If you click the github.io link you can examine the source code (the body won't be visible exactly because of the issue, but you can fix it with document.body.style.visibility = 'visible'). If you do that you will find the snippet above that is indeed in the HTML under a <script> tag. Also if I don't set the visibility of my body to hidden the blog is online perfectly. Commented Mar 19, 2018 at 15:20

1 Answer 1

1

I looked at your site you linked in your answer- looks like this script is commented out! And therefore will not run. Attached is a screenshot.

Screenshot of production code for https://botev.github.io/, showing the script in question is commented out.

Sign up to request clarification or add additional context in comments.

2 Comments

To add to this it looks the the script is being minimized so all the text is on one line. Making the // comment out the whole thing.
Thanks, it was indeed the issue of minimizing that made the script commented out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.