• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Headers and the use of canvas in IE

 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not following what you are doing or running up against. Especially the difference between the 1st and 3rd scenarios.
 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A 502 error doesn't likely have anything to do with the body: http://www.checkupdown.com/status/E502.html
 
Sresh Rangi
Ranch Hand
Posts: 52
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic