Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser doesn't refresh if script tag is added #421

Open
thatanjan opened this issue Sep 9, 2023 · 0 comments
Open

Browser doesn't refresh if script tag is added #421

thatanjan opened this issue Sep 9, 2023 · 0 comments

Comments

@thatanjan
Copy link

Before submitting an issue, please, see https://github.com/tapio/live-server#troubleshooting

Issue description

I have this HTML

<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<link rel="stylesheet" href="styles.css" />
</head>

<body>
	<h1>
		Elit tempore autem natus nobiso
	</h1>
	<h3>
		Sit sapiente ad aliquid similique suscipit veritatis architecto, voluptatum Sunt.
	</h3>

	<button id="open-modal-button">Open My Modal</button>
	<dialog id="customModal">
		<form method="dialog">
			<input type="text" name="" value="" />
			<button>OK</button>
		</form>
	</dialog>
	<script>
		const modal = document.getElementById('customModal')
		const openButton = document.getElementById('open-modal-button')
		const closeButton = document.getElementById('close-modal-button')

		openButton.addEventListener('click', () => {
			modal.showModal()
		})

		closeButton.addEventListener('click', () => {
			modal.close()
		})

		const modal2 = document.getElementById('customModal')
	</script>

	<script src='./index.js' type='text/javascript' />
</body>
</html>

If I keep the script tag then the browser doesn't refresh automatically. The script tag from live server doesn't get injected.
image
Removing the script tags just works fine.

Software details

  • Command line used for launching live-server:
  • OS: ArcoLinux
  • Browser (if browser related): tested both on Brave and Firefox
  • Node.js version: v 20.4.0
  • live-server version: v1.2.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant