question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Live Reload is not possible without body or head tag

See original GitHub issue

I’m submitting a…

[ ] Regression (a behavior that used to work and stopped working in a new release)
[ x ] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request
[ ] Other: <!-- Please describe: -->

Current behavior

The web browser shows something when I just run the extension and connect to a port No. but when I make changes to my html files the error message (“Live Reload is not possible without body or head tag”) pops up and the web browser shows nothing (blank). I have to close the server and reconnect it every time for web browser to show the new web contents. When I added an extra <html> or </html> the Live Server works fine for some reason.

I installed Live Server 8 months ago and it worked fine until recently when I tried to use it again after 4 months of inactivity and updated to the new version of it. I tried to open my old html documents that used to work fine with Live Server and don’t work fine with it now. I thought I might have changed my codes and copied some codes from https://www.w3schools.com/html/default.asp but the Live Server behaved the same way.

The codes I copied from the link and with issue

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

</body>
</html> 

The codes that work fine with extra <html> or </html>

<!DOCTYPE html>
<html>
<html>     <!-- extra -->
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html> 
<!DOCTYPE html>
<html>
</html>              <!-- extra -->
<head>
<title>Page Title</title>
</head>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html> 

Expected behavior

It should reload and work without the extra <html> or </html>, like last time, without problem.

Environment

Browser:

- [ ] Chrome (desktop) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] IE version XX
- [ x ] Edge version 42.17134.1.0

For Tooling issues:

- Live Server: 5.3.0 
- Platform:  Windows 
- Visual Studio Code: 1.30.2 

Others

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
pgluzcommented, Feb 20, 2019

Just click to turn off when it prompts

This is not the solution. The problem is not the annoying notification, but the fact that auto-reload doesn’t work. In my case is even worse - instead of the mentioned notification, Live Server shows a blank page, doesn’t matter what I type as a code.

2reactions
proton2021commented, Jul 30, 2021

After reading other posts decided to make a small change in the index.html page from: charset=“UTF-8” to “utf-8” and it started to work again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Live Reload is not possible as body or head tag or defined ...
It is because you have made a media query on your file and your display screen/window is in that size, and since you...
Read more >
Live Reload is not possible without body or head tag
It's not clear what you are trying to do. Are you trying to reload the page using javascript? · So you don't have...
Read more >
live reload is not possible without a head or body tag. what is ...
I tried turning off the live server extension and opened it in the browser from the HTML file directly and nothing changed.
Read more >
Visual Studio Code Live Reload - Super User
I am testing an html file and I need to reload upon save. I've seen many tutorials update the view of an html...
Read more >
Live Reload is not possible without body or head tag.
Live Reload is not possible without body or head tag. ... I am facing this issue whenever I make same changes in my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found