Closed akrsnr closed 5 years ago
Nancy will output whatever you tell it to output, so its probably a bug in your toHtml method, you're probably not outputting valid HTML with head tags, so the browser is trying its best to interpret the content and wrapping it in a body tag.
Nancy will output whatever you tell it to output, so its probably a bug in your toHtml method, you're probably not outputting valid HTML with head tags, so the browser is trying its best to interpret the content and wrapping it in a body tag.
So, isn’t there any Nancy-way to put my strings into
tags other than my toHTML() method?I'm not entirely sure what you're trying to achieve, but what you're doing there is returning an entire html document formed from whatever you toHTML method is returning. If you're wanting to combine that with other html/templates you should have a look at view engines, if you're wanting to update content that's already in the browser via ajax then that's nothing really to do with nancy.
I’m creating form via C# and Nancy and not using extra
.html
files. It creates html codes viatoHTML()
method written by me. After obtaining the html code as string, I usereturn Response.AsText(form.toHtml(), “text/html”);
. When I investigate the html code on a browser, the codes are put into<body>..</body>
tags. What if I need to put the following?How can I put them into
<head></head>
tags?