aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Headers and the use of canvas in IE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Headers and the use of canvas in IE" Watch "Headers and the use of canvas in IE" New topic
Author

Headers and the use of canvas in IE

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 823
I have a perl script that parses a html file (replacing sections of html with content from files or such).

If I put in :
at the top line in the html file followed by a few newlines and then the html code I get a 502 error. If I just put in followed by the same new-line characters the page displays fine but the embedded canvas object and javascript code doesn't work (the canvas tag's inner text displays to show it's not supported). The URL is a call to the XXXX.pl that generates the html on the page.

If I create a simple html file with at the top everything works fine, even the canvas.

What should I be printing out for the headers to get the page to display AND the canvas to be recognized? Thanks in advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

Not following what you are doing or running up against. Especially the difference between the 1st and 3rd scenarios.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 823
If I have a plain .html page with a canvas tag in it and <!DOCTYPE html> at the top the canvas displays fine (just an empty canvas with border set).

If I have a html page (even the same html as above) that gets read in by a perl script on the server and all the perl script does is spit out the content of the html page via prints (canvas tag and all) I get a 502 error. So the URL instead of being something.html it's some_perl_script.pl (which reads the html page and spits it back as a response). If I insert a print of "Content-type: text/html\n\n" in the perl script the page comes up in the browser but the canvas tag isn't recognized because there is no <!DOCTYPE html> now just the Content-type header. If I try to mix and match the Content-type and DOCTYPE lines to be sent back to the browser (in the perl script) I'm still unsuccessful.

The difference between the cases is one way it's embedded in a html page that is getting called directly (i.e. the URL points to the html page) and the other way is a perl script is being called in the browser (i.e. URL points to the .pl) - the script reads the html and prints content to output.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

A 502 error doesn't likely have anything to do with the body: http://www.checkupdown.com/status/E502.html
Sresh Rangi
Ranch Hand

Joined: Nov 28, 2012
Posts: 47
    
    2
Perl uses CGI so you need to print the content-type, a blank line, and then the html content. So something like:


The content-type is the mime type telling the type of file you're sending, and the doctype tells what standard and version of html you're using. You need to include both.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Headers and the use of canvas in IE