http://developer.mozilla.org/ is your best reference.
Avoid any articles written by Microsoft.
Javascript: The Good Parts is not a teaching book. It's for those who know the language. Instead get "The Definitive Guide".
WARNING: some of these tips are trivial or browser-specific, not good general tips. In particular David Calhoun's:
> You can pass arguments into setTimeout and setInterval
Not unless you want your code to break in IE, you can't.
Moreover, architecting your code assuming you can pass references and complex objects into setTimeout
ed/setInterval
ed functions and then finding out that it doesn't work in IE (where the entire function call has to be decomposed back down to a string) hurts, and often requires hideous hacks (dumping objects into global variables - shudder) or a complete re-design of that part of the system.
Believe me I know, because I was bitten by exactly this issue when writing a custom Javascript library for my employer.
> Old String functions
Whooo. Someone's realised that they can browse the Javascript String object documentation (developer.mozilla.org seems to be down temporarily, but it's all right there in the documentation, and always has been).
> An HTML element with an ID creates a JavaScript global with the same name
Not in Firefox it doesn't. Try it.
In case you're wondering why this is getting down voted, w3School is not a good site.
You might want to check these,
Websockets is just a protocol. SocketIO is a library (not a framework) and it's not a websocket library, websocket is one of the things it uses unless there's no websocket support.
That said, websocket can be used directly without any library usage. You can just create a WebSocket object and connect it with a WebSocket backend endpoint.
http://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
If you wanna do something more complex, I would suggest SocketIO. It provides you things that you have to self maintain and create from scratch with WS. Such as rooms, subscriptions, re-connect, ping, message protocol. The big con being you're binded to use SocketIO. And SocketIO is not being officially supported in other languages except NodeJS of course. So if youll want to have a WebSocket support to your NodeJS server from a Golang server, it will be quite hard thing to implement in Golang as there is no official SocketIO library and the unoficial cannot be trusted for long term maintainance or sustainability.
But if you wanna go with something simple, I would suggest pure WebSockets. Just use the built in standard library for websocket communication.
i'd advise against w3schools, because they do some naive stuff on there. document.write
, adding event listeners on body.onload
, <script>
tags in the <head>
, and other things. i'd recommend using the mdn instead.
Yeah so they have a "template" for their page layout from above:
{{each(m, mov) $item.data.Movies}} <div class="movie-list-item movie-container-item split-content" data-id="${mov.Id}" data-popularity="${mov.Rank}" data-name="${mov.Name}" data-genres="${mov.Genres}" data-rating="${mov.Rating}" data-featured="${mov.IsFeatured}"> <a href="${mov.MovieUrl}"><span class="title">${mov.Name}</span></a><span class="${EVO.rating(mov.Rating)} rating">${mov.Rating}</span>
So when you open https://www.eventcinemas.com.au/Cinema/Pacific-Fair in your browser it makes an XMLHttpRequest
to their API at https://www.eventcinemas.com.au/Cinemas/GetSessions?cinemaIds=23
and then populates their template with the JSON response data.
http://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
Javascript and Java have nothing to do with each other, except the name.
Java is a language running on the JVM, a runtime an user needs to install in order to run Java programs. Javascript is an unrelated language that is used on the web to script web pages.
You don't need Java to run JS, what you need for JS is a web browser.
You seem really inexperienced, so I recommend the easy way: HTML, CSS, JS. You can learn all three from htmldog.com (there's also codeacademy and w3schools, but I don't think very highly of them). There's also html5doctor.com, but it specializes in HTML only (version 5 of HTML, obviously).
Make sure you do lots of excercises in JS though. The above sites will teach you, but you'll forget everything if you don't practice it. A source of excercises is /r/dailyprogrammer , and also projecteuler.net.
Also add http://developer.mozilla.org/en-US/ to your bookmarks, it's the most detailed reference for HTML, CSS & JS right now (although there are some new players in town more recently that are still too young to be usable). When you have any questions about web development, go to mdn, chances are you'll find your answer after some digging. And for fuck's sakes, do yourself a favor and make sure you use the latest version of a decent browser like Firefox or Chrome, not Internet Explorer.
I'm going to go against most of the other commenters here.
Unless you absolutely need wrapper divs because of a complex design, you should just style the <body>
element. You can even style the <html>
element if you need an "outer" wrapper (though it behaves a bit differently than other elements and you need to be aware of this).
HTML should be structured for its semantic meaning based on the content, then styles should be added to this semantic structure. Ideally you would not go back and change the markup at this point (presentation should be layered on top of semantics, not the other way around), but occasionally due to the lack of expressiveness of CSS you will need to add some "meaningless" elements to accomplish particular designs (usually this comes down to faking "math" in CSS, e.g. having an element be "80% - 30px" wide, though in this regard calc() is a godsend and will be a game changer once broadly supported). In the majority of cases, adding such bullshit elements isn't actually necessary, and often designers who tell you otherwise are just being lazy or doing it out of habit.
You encode those variables in the link to the second HTML page, and then decode them in the JavaScript of the second page.
(Like when you see the URLs on Google Maps or Amazon or whatever and they're ridiculously long...that's what they're doing. It has the added benefit of being a permanent resource too so you can always navigate to the page and get the same result)
One place you can go to get acquainted with HTML and possibly CSS is www.codecademy.com.
How I started though, was just to build a static website and constantly look up everything I needed. You can look up practically everything at developer.mozilla.org
What this means is that anyone who knows or can find the URL to your audio file can download it.
Lets take our previous JS fiddle example. The src attribute points directly to our audio file from mozilla. This is plainly visible to anyone who looks at the source code or even inspects the element.
Once someone knows the URL all they need to do is point their browser at the file and they have free access to download at their leisure. ( Try it, click that link and hit ctrl+s. Free audio file )
For some situations that doesn't matter, for others protecting your files is a little more important. There are things that can be done on the server that can improve this, but that gets more complicated.
So, while this approach is super simple and rather nice it does indeed provide no security for you audio files.
> a very common use-case
[citation needed]
Seriously though, this service is designed to keep all of your Firefox installations in sync, across all of your devices. If that's not what you want, perhaps there's an add-on that'll do the trick? (XMarks? Everysync?)
If not, have you considered raising a bug or feature request to make sure the Firefox Sync developers are aware of what you want/need?
[edit: speeling]
1. I was more thinking they're like an agent of the structure, as opposed to the structure itself. But that's probably open to interpretation, or I'm just wrong.
6. Yeah, but MDN. It's wiki-based so much more reliable and also Mozilla. Fair enough w3schools is probably alright for beginners, but I would move to MDN pretty sharpish.
8. Attribute selectors! A CSS selector that selects things based on a specified attribute.
So if you wanted all links to http://google.com
to be red for some reason, you can!
a[href="http://google.com"] { color: red; }
[](/sbstare "a[href|="/sbstare"] { /* CSS GOES HERE */ }")This is also pretty much how emotes work.
Aaronmt, how did you forget to reference Mozilla Developer Network? :) Check out that site for great tips and examples if you'd like to develop under Mozilla's best practices.
Avoid W3Schools, it promotes bad practices and is littered with factual errors. If you want to read more about that check out W3Fools
Instead use the MDN as a resource. It's much better and since it's wiki, errors can be quickly caught and fixed.
> And I want to learn more HTML, Java, php, etc.
It behooves me to say that Java is to JavaScript as Car is to Carton, sure they have similar names but they are not the same thing. Java is an imperative language (mostly) that employs a classical inheritance structure. JavaScript is a functional language (mostly) that employs a prototypical inheritance structure. Other than the name the only major thing that they have in common is a C/C++ like syntax structure. Please don't get them mixed up.
As a div, it is not an image used to convey information. If you put it in as an image assistive technology if going to read it as an image conveying info unless you set the role to presentation.
Check the example on Mozilla, not used with an images tag
> based on Ubuntu 14.04
Yikes.
> hopefully without breaking a bunch of other stuff on my install when I upgrade libdbus.
I wouldn't recommend that, it's almost guaranteed to break other software already part of your system. Have you not considered simply updating to Mint 19.x? That should be much safer (I'm not actually familiar with Mint, but Ubuntu and Debian both have well-supported in-place upgrades, it would be wild if Mint did not).
If you don't want to do that, I'd recommend trying your hand at building from source over trying to update dbus. Generally, by the way, compiling stuff is pretty easy: you just need the right packages installed, then it's usually a single command (make
) and perhaps some time waiting. That's not the case for Mozilla Firefox and by extension Waterfox, unfortunately. It is quite a bit more complicated than that. That being said, if you're already willing to risk an unsupported update of a core system service that most of your desktop depends on, this is at least way less risky than that. It might not work out, but it won't affect the rest of your system. See http://developer.mozilla.org/en/docs/Build_Documentation if you're interested in that.
Session Manager extension broke after updating from 56.2.14 to this version, under Windows 7 x64.
Session auto-saving functionality after closing its window doesn't work anymore.
When restarting the browser, previous opened sessions aren't restored properly either.
I've tried disabling all plugins but this, tinkering with options, reinstalling it, clearing sessions and none of them worked.
All went back to normal after reinstalling Waterfox previous version (56.2.14).
If any changes or bug-fixing has been made to the firefox SessionStore own mechanism, that could be the root cause for this issue.
Let me know if you need more information or any help for tracking this issue down.
I was actually going to say that a combination of resources is probably the best way, at least in my opinion, to learn programming. However, I think FreeCodeCamp is pretty popular and offers an interactive way to learn web development, which I think is pretty neat.
The other resources are also pretty good (I've used them all except for The Odin Project), so I would recommend checking them out too if you have some time or if you need some reference material. CodeCademy is similar to FreeCodeCamp in that you can learn by actually writing code in the browser, but you do have to pay for access to some of their courses.
One more reference to add to the list would be Mozilla's MDN Web Docs, which offers documentation on a variety of languages and what not.
Please note:
I hate Chrome for an passion. First - Extension have security/malware they do NOT scanned the extension like AMO (Mozilla reviewed the addons for security.)
Quoted from page > All add-ons listed on AMO may be subject to code review and testing by a team of employees and volunteers. In some cases, an add-on may require a review before it can be listed. In these cases, review times can range between a few hours to a number of weeks depending on an add-on’s complexity and other factors.
Quoted from page > Self-distributed add-on files are automatically reviewed and signed. The add-ons review team may, from time to time, perform a manual review of your signed add-ons and give you feedback about them.
Continued here
> just thrown all this together from various sources I found online
I think that's how a lot of people got started, myself included. There are a lot of good resources out there, like the MDN and of course the jQuery documentation, full of code samples and detailed info on all the methods and objects you'll want to use. Good stuff!
> So now that I've got the onerror, if it encounters and error, it will bounce down to the CheckLoadTotal function which then will append the images to #images if the load_total is 0 which means it's the last image in the array?
That's pretty much the routine, yep. For the (load_total<=0) bit, that's really just a best practice, in this situation I don't see how it could end up ticking past 0, but that can come up from time to time when using a counting approach like we did here. Just habit really, that could just as well be (load_total==0) or (load_total<1) and should still work as expected.
Figured. Though, I don't understand why they have a webpage about it if they don't support it.
Safari also doesn't support it. That really puts a damper on things.
Before Gecko 1.8.1 (Firefox 2), it was called JavaScript Console
Hum, maybe Firefox 1.0 didn't even have the "JavaScript Console". I don't think I ever used Firefox before 2.x
As for Netscape, that's even older, I don't really remember it (I used mostly Explorer back then… eww). So yeah, it'd be interesting to see how this page would load in those dinosaurs (maybe I could install a win98 VM and find out…)
The mouse cursor then.
Have you tried starting Firefox in safe mode?
Help → Restart with Add-ons Disabled
If it doesn't work when you do that then it's a bug and it would be helpful of you to file a bug report.