background preloader

Javascript

Facebook Twitter

Is Java ready for HTML5? Every new Apple mobile device and MacBook supports the latest HTML5 standard. Some of the biggest social networking sites, including Facebook, already use HTML5 in their content delivery. But senior Java application developers must still ask the question: Is the Java community ready for HTML5 development and integration efforts? HTML5 is improving end-user experience by helping to provide more interactive content directly through the Web browser, simplifying rich content delivery and reducing the importance of proprietary technologies such as Adobe Flash and Microsoft’s Silverlight.

In the rich content space, the only pure Java solution offered by Oracle would be JavaFX, which can be seen as both interoperable with HTML5 and also threatened by it. At JavaOne in September of 2011, Cameron Purdy and Adam Messinger unveiled Project Avatar in an effort to help simplify the task of developing applications that leverage HTML5 technologies. Getting JSF ready for HTML5. Ludei’s CocoonJS enables blazing-fast HTML5 mobile games (exclusive) As the lingua franca for the web, HTML5 is becoming the format of choice for making cross-platform apps.

But when it comes to games, HTML5 apps run too slow. So Ludei, a San Francisco company with a team in Spain, is launching a new platform to turn the HTML5 games into blazing fast applications that take advantage of the graphics hardware in mobile devices. Making HTML5 games run fast is important because it will simplify life for game developers.

Right now, they have to use valuable resources either creating cross-platform but slow games or fast native apps that have to be rewritten for each new platform. “We manage to get much better performance for games in a browser,” said Eneko Knorr, chief executive and founder of Ludei. The free tool can be used to quickly port HTML5 games so that they run on the iPhone and Android devices as if they were native code, or specially written to take advantage of every piece of hardware in the mobile device, such as its graphics chip. Event order. Page last changed today See section 7D of the book. Netscape 4 only supports event capturing, Explorer only supports event bubbling. Netscape 6 and Konqueror support both, while Opera and iCab support neither.

On the Introduction to events page I asked a question that at first sight seems incomprehensible: “If an element and one of its ancestors have an event handler for the same event, which one should fire first?” Not surprisingly, this depends on the browser. The basic problem is very simple. Suppose you have a element inside an element ----------------------------------- | element1 | | ------------------------- | | |element2 | | | ------------------------- | | | ----------------------------------- and both have an onClick event handler.

Not surprisingly, back in the bad old days Netscape and Microsoft came to different conclusions. Netscape said that the event on element1 takes place first. The two event orders are radically opposed. When you use event capturing When you use event bubbling. XML DOM Parser. Turn.js - The page flip effect for HTML5. A tale of two viewports — part one. Page last changed today In this mini-series I will explain how viewports and the widths of various important elements work, such as the <html> element, as well as the window and the screen. This page is about the desktop browsers, and its sole purpose is to set the stage for a similar discussion of the mobile browsers. Most web developers will already intuitively understand most desktop concepts. On mobile we’ll find the same concepts, but more complicated, and a prior discussion on terms everybody already knows will greatly help your understanding of the mobile browsers.

The first concept you need to understand is CSS pixels, and the difference with device pixels. Device pixels are the kind of pixels we intuitively assume to be “right.” These pixels give the formal resolution of whichever device you’re working on, and can (in general) be read out from screen.width/height. If the user zooms, however, this calculation is going to change. A few images will clarify the concept. Meaning Fun! A tale of two viewports — part two. Page last changed today Related files: Part one of this article, about desktop browsers.

Compatibility tables. The full list of browsers can also be found here. Many thanks to Grace Kloba (Google), David Storey and Anne van Kesteren (Opera), Mike O'Malley (Microsoft), Kartikaya Gupta and George Staikos (RIM), and Mark Finkle (Mozilla) for reviewing earlier versions of this piece and providing me with valuable feedback. This article has been translated into Russian, Chinese, and Korean. In this mini-series I will explain how viewports and the widths of various important elements work, such as the <html> element, as well as the window and the screen. On this page we’re going to talk about the mobile browsers. When we compare the mobile browsers to the desktop ones, the most obvious difference is screen size. A mobile screen is far smaller than a desktop screen; think about 400px wide at maximum, and sometimes a lot less. Let’s go back to our sidebar with width: 10%.

Meaning Measured in Problems. The this keyword. Page last changed today One of the most powerful JavaScript keywords is this. Unfortunately it is hard to use if you don't exactly know how it works. Below I explain how to use it in event handling. Later on I'll add some information about other uses of this. The question that we'll discuss for the remainder of the page is: What does this refer to in the function doSomething()? Function doSomething() { this.style.color = '#cc0000'; } In JavaScript this always refers to the “owner” of the function we're executing, or rather, to the object that a function is a method of. This "ownership" is the result of JavaScript's object oriented approach. If we execute doSomething() without any more preparation the this keyword refers to the window and the function tries to change the style.color of the window. So if we want to use this to its full extent we have to take care that the function that uses it is "owned" by the correct HTML element.

Element.onclick = doSomething; you do not copy the function! Document Object Model (DOM) Level 3 Events Specification. 3. DOM Event Architecture 3.1 Event dispatch and DOM event flow This section defines the event dispatch mechanism of the event model defined in this specification. Applications MAY dispatch event objects using the EventTarget.dispatchEvent() method, and implementations MUST dispatch event objects as if through this method. The behavior of this method depends on the event flow associated with the underlying object. An event flow describes how event objects propagate through a data structure. Event objects are dispatched to an event target.

The propagation path MUST be an ordered list of current event targets through which the event object MUST pass. In the DOM event flow, event listeners might change the position of the event target in the document while the event object is being dispatched. Exceptions thrown inside event listeners MUST NOT stop the propagation of the event or affect the propagation path. As the next step, the event object MUST complete one or more event phases. Note. Get the content of an Iframe in Javascript – crossbrowser solution for both IE and Firefox « Eivind’s Weblog.

Ok, let’s imagine the use case: I have an iframe somewhere on my page, and when I click a link or a button I need to get the content of it (could be a textarea e.g.), and then do some stuff with it. It was easy to do this in IE, but for Firefox I struggled more, as I kept getting the “frame has no properties” error message in the console.

And when I solved this I couldn’t get to the content. There is a lot of references out there claiming that you could use document.frames['nameOfMyIframe'] or window.frames['nameOfMyIframe'] to get the frame, and then use the .innerHTML to get the content, but both are wrong. I came up with the following function that seems to do the job in both Firefox (tested on version 2.0.0.11 and 3.03 ) and in IE (6 and 7): This wasn’t my biggest contribution, but I spent some time trying to find this solution, and for some of you it might be helpful saving you frome some heavy googling. Main.html: Frame.html: Like this: Like Loading... jQuery Mobile.