2014
Mar
25

The postMessage API is supported by all modern browsers including IE8. It allows windows/frames from multiple domains to communicate with each other. IE8 doesn't allow to postMessage to other windows, only to iframes. Cross-window messaging security model is two-sided. The sender ensures that the receiving domain is targetDomain. The receiver checks that the message came from proper event.origin.

2014
Mar
14

Based on the library bootstrap model and jstree, I built the library Treeview to select a file from the file cabinet and do copy or move.

2014
Mar
11

Render TV list data, set the cursor focus on the item, and go on the next when pressing the Enter key. Y.TVList doesn't deal with any style with CSS. Users have to handle on their own.

2014
Mar
10

Preloading images is a great way to improve the user experience. When images are preloaded in the browser, the visitor can surf around your site and enjoy extremely faster loading times. This is especially beneficial for photo galleries and other image-heavy sites where you want to deliver the goods as quickly and seamlessly as possible. Preloading images definitely helps users without broadband enjoy a better experience when viewing your content. In this article, we’ll explore three different preloading techniques to enhance the performance and usability of your site.

2014
Mar
09

The load event is a general “loading complete” signal. It is supported by many elements. For example, external SCRIPTand IMG, IFRAME trigger it when downloading of their content finishes. The handler window.onload and iframe.onload triggers when the page is fully loaded with all dependent resources including images and styles. The DOMContentLoaded event triggers on document when the page is ready. It waits for the full HTML and scripts, and then triggers.

2014
Mar
06

ECMAScript 5's Function.prototype.bind is a great tool that's implemented in all modern browser JavaScript engines. It allows you to modify the context, this, of a function when it is evaluated in the future. Here's a common use case that developers need to watch for. Turns out that since we added the event listener to the window object, this in the event handler or callback refers to window.

2014
Mar
05

If the function is able to assign values to its parameters, only its local copy is assigned — that is, anything passed into a function call is unchanged in the caller’s scope when the function returns. Pass-by-reference typically means that the function can modify (i.e. assign to) the variable used as argument — something that will be seen by its caller.

2010
Oct
03

The href attribute is different to other element attributes in that the value set can be relative to the context of the page URL. The browser will look at the pages current URL and derive an absolute URL for the link. This is the root of the problem, some browsers return the text of the attribute and others(IE6/IE7) return the derived absolute URL.

2009
Aug
07

Creating an XMLHttpRequest object. Specifying and submitting your HTTP request to a web server. Synchronously or asynchronously retrieving the server's response. The readyState property defines the current state of the XMLHttpRequest object. 0: The request is not initialized. 1: The request has been set up. 2: The request has been sent. 3: The request is in process. 4: The request is completed.

2009
Jul
16

There is a bug in IE (version 6 and 7) in which the clarity between <code>window.onresize</code> and <code>body.onresize</code> is muddied. This can cause quite a problem for developers and even render the client's browser unresponsive (throttling the CPU to near 100%) if you're not very careful. IE fires the onresize multiple times while Firefox only fires it once after the browser has completed resizing.