Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: HTML5 problems...  (Read 2253 times)

0 Members and 1 Guest are viewing this topic.
HTML5 problems...
« on: May 16, 2012, 03:58:58 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 57
I've written a program that uses the <canvas> to do various things... basically palette swaps (like filter type stuff... grayscale, sepia, inverting the colours, etc.) and also it generates ASCII art.  You choose a picture on your hard drive or on the internet somewhere and can make it do the stuff.

So the first problem I'm having is that for some reason images from the internet don't work on Firefox (at least on my computer).  They appear on the <canvas> but that's it... the functions basically stop working after that.  It's not my code, as it works fine in Safari.  It also works fine for any image from the person's hard drive... even if that person types the file path into the URL box on my page (the box normally used for typing in web addresses... there's a separate file selector thing on there specifically for local files).

Second, this is more of a question on HTML / JavaScript in general, but what's a good / easy way to tell browsers apart?  I need to do so because upon testing my program, I've found that there are some huge differences between Safari and Firefox.  One difference was so great that it caused the program to not even be able to run in Firefox...
So currently I'm using this:
Code: [Select]
if (navigator.userAgent.indexOf("Firefox")!=-1){
    // stuff for Firefox to do
}
else{
    // stuff for other browsers to do
    // (so far I'm only testing it on Firefox and Safari, but I'll
    // add other else if statements later)
}
which seems to be working fine, but I'm wondering if there's anything wrong with that.  Also I don't really understand that code... how do I know what I should change it to for every browser?  Like, would just changing the string "Firefox" to some other browser's name work?

Third question... the DOCTYPE.  For some reason the page does not display properly when I give it the HTML5 DOCTYPE... it doesn't even seem to display correctly with an HTML4 DOCTYPE either... but works fine when I give it no DOCTYPE at all.  I'm using nothing deprecated so I don't know what the problem could be.
« Last Edit: May 16, 2012, 04:02:43 am by dannyjenn »
Logged
Re: HTML5 problems...
« Reply #1 on: May 16, 2012, 01:41:25 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 57
Okay, we can ignore the second qurstion.  I haven't figured it out but I've changed the code to make it so that it works regardless of the browser.

Still wondering about the first and third though.
Logged

DaSpirit

The Quiet
Re: HTML5 problems...
« Reply #2 on: May 17, 2012, 01:34:46 am »
  • The Mad Programmer.
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 87
And obvious question - are your browsers up to date? I have problems with HTML5 on Safari at my school.

Your first question, it might be the security that Firefox adds to local files. If anything, it might be your config. Type "about:config" as the URL and there's probably a variable you have to change.

Your third question, it's supposed to be !DOCTYPE, just make sure you got that right.
Code: [Select]
<!DOCTYPE html>
I recommend you use a validater to check your code for errors. I use this one.
Logged
I support:
Re: HTML5 problems...
« Reply #3 on: May 17, 2012, 03:41:17 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 57
And obvious question - are your browsers up to date? I have problems with HTML5 on Safari at my school.
Safari is not... the newest version of Safari isn't available for Leopard (which I'm using).  I am using the most up-to-date Safari available.
But that doesn't explain why it's not working on Firefox (version 12.0), which as far as I know is the most current version.

Quote
Your first question, it might be the security that Firefox adds to local files. If anything, it might be your config. Type "about:config" as the URL and there's probably a variable you have to change.
That may be it... strange part is that the images partly work.  They are drawn on the canvas.  Basically I have code that upon the image loading, it goes through every pixel on the canvas and alters it according to what's currently there... if the image is already there (which it is, as I can see just by looking at it) then there should be absolutely no reason why the rest of the code wouldn't work, since the image itself isn't even involved from that point on.

Quote
Your third question, it's supposed to be !DOCTYPE, just make sure you got that right.
Code: [Select]
<!DOCTYPE html>
I recommend you use a validater to check your code for errors. I use this one.
Yeah, that's the one I currently have but it's not working.  The styles seem to be messed up... one of the <div>s isn't being aligned properly, another of the <div>s's height has somehow become really small (hiding much of the text and adding a vertical scroll bar), and another <div>'s text spacing properies are being ignored.  But only when using the HTML5 DTD... when I use none at all it works fine.

That validator found no errors so the code itself is perfectly fine.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.025 seconds with 45 queries.