Reputation: 2670
Having an .html
file is it possible to force the browser to treat the contents as XHTML? I mean the file opened from both local or web location. Maybe some on-the-fly convertion or something like that?
The background:
Firefox and Opera supports natively MathML when the code is embedded in a XHTML file. I need to get a .html
file with MathML that would be supported by the mentioned browsers properly.
Thank you for any support.
Upvotes: 2
Views: 590
Reputation: 44396
File extension has nothing to do in this case. The only thing that really matters is the Content-Type
header. By default your webserver treat .html
files, as text/html
, but you should force it to send is as application/xhtml+xml
.
If you're using any server-side language, you can do something like that (PHP example)
header('Content-Type: application/xhtml+xml');
If you're unable to use any programming language, then you can configure your webserver to treat .html
files as XHTML (Apache, .htaccess
example)
AddType application/xhtml+xml .html
I didn't noticed that you're also trying to open XHTML from local file. Then file extension may be important - but David Dorward answer to that case.
Upvotes: 0
Reputation: 944116
For local files (see below if you are using a server):
Browsers generally only run off file extensions for determining if a local file is HTML or XHTML.
Your options:
For files served via HTTP:
Consult the manual to find out how to change the content type for a given file extension. For example, Apache can use the AddType directive.
Upvotes: 2