aspnetcore-browser-refresh seems to be checking the </body> tag for replacement, which is causing my problem
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
When I tried to write a method to print the current page, the addition of `_framework/aspnetcore-browser-refresh.js` caused an error on my page.
Example.
I added printdiv which contains .
```
function printdiv(printpage) {
var headstr = "";
var footstr = "";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr + newstr + footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
}
```
When viewing the source, it becomes like the following, and an error is reported `Uncaught SyntaxError: Invalid or unexpected token`
```
function printdiv(printpage) {
var headstr = "";
var footstr = "";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr + newstr + footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
}
```
### Expected Behavior
When adding a script tag, you should not just replace it based on , or replace it based on the last
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version
7.0.203
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.