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

hx:include tag is messing up the head tag #73

Open
appdezign opened this issue Aug 24, 2020 · 0 comments
Open

hx:include tag is messing up the head tag #73

appdezign opened this issue Aug 24, 2020 · 0 comments

Comments

@appdezign
Copy link

I'm using hinclude to include a CSRF token in a laravel blade page that has been cached with HTTPCache.
When I put the CSRF token inside the body tag, everything works as expected.

<body>
<form>
<hx:include src="/csrf/input">
	<input type="hidden" name="_token" value="2viCQ8L7G0aHOsEQwf811kR2wLoozZl3uhEemshv">
</hx:include>
</form>
</body>

But when I put the CSRF token in a meta tag in the head (for AJAX requests), the head gets mixed up when I look in the web inspector. The hx:include tag has been moved to the body(!), and every tag that comes AFTER the hx:include tag in the head, is also moved to the body. See code example below.

My question is: am I doing something wrong here? Or are we not supposed to us the hx:include tag in the head?

View source (Chrome):

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<script src="/assets/themes/ambion2020/js/vendor/hinclude/hinclude.js"></script>
	<hx:include src="/csrf/meta"></hx:include>
	<meta name="description" content="">
	<meta name="keywords" content="">
</head>
<body>
	<div class="wrapper"></div>
</body>
</html>

Web Inspector (Chrome/Firefox):

<html lang="en"><head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<script src="/assets/themes/ambion2020/js/vendor/hinclude/hinclude.js"></script>
</head>
<body>
	<hx:include src="/csrf/meta" class="included include_200">
		<meta name="csrf-token" content="2viCQ8L7G0aHOsEQwf811kR2wLoozZl3uhEemshv">
	</hx:include>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<div class="wrapper"></div>
</body>
</html>
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