Vscode-live-server: Live Reload is not possible without body or head tag

Created on 20 Jan 2019  路  6Comments  路  Source: ritwickdey/vscode-live-server

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
```html



Page Title

This is a Heading

This is a paragraph.


The codes that work fine with extra ```<html> ``` or ``` </html> ```
 ```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> 

```html




Page Title

My First Heading

My first paragraph.


## Expected behavior
It should reload and work without the extra <html> or </html>, like last time, without problem.
<!-- Describe what the desired behavior would be. -->

## Environment

```html
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

need to check

Most helpful comment

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.

All 6 comments

Just click to turn off when it prompts

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.

Yep, got this problem now. Not bothered by the notice, it's the not reloading that's the problem. Is there a fix yet?

I got the same problem. In my case, the problem was a wrong file encoding in index.html. When I changed the encoding to ASCII or UTF-8, the Live Reload started working again.

I've been having this issue as well for my index.html

My solution was to delete the original file, then create a new file and copy over the code.

I created a separate test.html and live-reload was working again. Thought it was an encoding error so I copied my working test.html code into index.html. Still no luck. Deleted and then created a new index.html -- things are back to normal now.

I used to have it when I had a link to an .svg file that was not saved. Saving all files in the project could probably work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yzhang-gh picture yzhang-gh  路  5Comments

ghost picture ghost  路  6Comments

Zerotask picture Zerotask  路  4Comments

GaoHengdong picture GaoHengdong  路  4Comments

Stonerea656 picture Stonerea656  路  5Comments