A txt file embeded inside an object tag gives an encoding error when an app is running?

101 Views Asked by At

I am trying to build an HTML app without a local server, just for that. Some of content, which is made of txt files, I embed inside object tags. The problem is, aside from being it right or not, is that I see an error

  • File: sum content
  • HTML: html... <object data="file.txt"></object> html...

Results in:

  • Site: html... <object ...>#document with sum content</object> html...,
  • Console: ... The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.

The problem does not occure when I am running the site on a local server python -m http.server, which I expect is due to the server handling the protocols and encoding (?)

Without the server tho, when I changed the extension, both in the file and the tag, for html, there was no error at all, even when there were no tags in that file (like the one with charset, for example), but only text content. In both cases I saved the files in Atom with the same UTF-8 encoding

Same situation is for iframe and embed tags.

So the question is why only changing the extension makes it error free and is there some more valid way, as I want to keep text files in the app structure.

0

There are 0 best solutions below