0

Google Chrome doesn't render .xhtml file when I response:

http://localhost:56685/simple/OPS/cover.xhtml 

But when I use file protocol it renders sucessfully:

file:///C:/Users/Kosha/Downloads/cover.xhtml

Is not a problem with bad url as the browser starts downloading the document to hard disk.

<?xml version="1.0" encoding="UTF-8"?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title/>
    <link rel="stylesheet" href="style.css" type="text/css"/>
    <link rel="stylesheet" href="style.css" type="text/css"/>
    </head>
    <body class="cover">
    <svg xmlns="http://www.w3.org/2000/svg" class="cover-svg" viewBox="0 0 391 600">
    <image height="600" xlink:href="images/cover.jpg" width="391" xmlns:xlink="http://www.w3.org/1999/xlink"/>
    </svg>
    </body>
    </html>

1 Answers1

1

The most likely problem is with your HTTP server providing the wrong Content-Type for the file.

Some servers will claim that all files with unrecognized extensions are of type application/octet-stream, so you need to configure yours to use application/xhtml+xml for .xhtml files. (Meanwhile, .html would use text/html.)

$ telnet superuser.com 80 Enter ↵
HEAD / HTTP/1.0 Enter ↵
Host: superuser.com Enter ↵
Enter ↵
grawity
  • 501,077