Skip to main content

Posts

Showing posts with the label browser

Comparing the performance of $("#foo .bar”) and $(".bar”, "#foo”)

Scroll down for the getById.getByClassName vs. qSA comparison! If we wanted to select all elements of class "bar" which are inside the element with the ID "foo" , we could write this:

How are JavaScript host objects implemented?

I was thinking about this today and I realized I don't have a clear picture here. Here are some statements I think to be true (please correct me if I'm wrong): the DOM is a collection of interfaces specified by W3C. when parsing HTML source code, the browser creates a DOM tree which has nodes that implement DOM interfaces. the ECMAScript spec has no reference of browser host objects (DOM, BOM, HTML5 APIs etc.). how the DOM is actually implemented depends on browser internals and is probably different among most of them. modern JS interpreters use JIT to improve the code performance and translate it to bytecode I am curious about what happens behind the scenes when I call document.getElementById('foo') . Does the call get delegated to browser native code by the interpreter or does the browser have JS implementations of all host objects? Do you know about any optimizations they do in regard to this? I read this overview of browser internals b

Best way to determine user"s locale within browser

I have a website (Flash) localized into a dozen of languages and I want to auto-define a default value depending on the user's browser settings in order to minimize the steps to access the content. FYI, I cannot use server-scripts due to proxy restrictions, so I guess JavaScript or ActionScript would be appropriate to solve the problem. Questions: What would be the best method to 'guess' the user's locale ? Are there any existing simple classes/functions that could help me out (no complex localization bundles) ? Specially to break down all the possible languages into a smaller number (the translations I have) on a smart way . To which point can I trust such a solution ? Any other workarounds or suggestions ? Thanks in advance! Source: Tips4all

How to register some URL namespace (myapp://app.start/) for accessing your program by calling a URL in browser in Android OS?

So I want to create an Android app so it would be registered somewhere in android OS (or just would start on system start) and when phone user clicks on special button on a web page inside a web browser a la: <a href="myapp://mysettings">Foo</a> my app would pop up and run using the params sent in that URL. So how do I do such thing? I need a tutorial with code! Source: Tips4all