Introduction Google chrome has a feature that allows you to create shortcuts to web pages and make them appear like traditional desktop applications. For example, a shortcut to twitter mobile might be The file icon for this app is stored in My Question It’s been a while since I’ve used this featur…
Tag: javascript
How can I make an element trigger a function on any, and all events?
I don’t think an explanation of my specific scenario would help much here. So in short I need to know how I can call a function on any and all events. The idea is to call the same function no matter what event happens to a specific element. In my head the ideal way to do this would go something
Multiple websocket connections
Is there any advantages of having two distinct websocket connections to the same server from the same client? To me this seems a bad design choice, but is there any reason why/where it should work out better? Answer There are several reasons why you might want to do that but they probably aren’t too com…
How do I fix this missing semicolon syntax error in Javascript?
A friend wrote some code for me, and there was one file with a weird syntax error in it. After a bit of hunting, I narrowed it down to this section of code, which should reproduce the error: When I run this, I see an error in the Internet Explorer console that says SCRIPT1004: Expected ‘;’. I don&…
How can I exclude an element from a mouseover event with Javascript?
I’m basically trying to build the equivalent of the firebug inspector in the browser. I’m currently using the <body> as the container in this example: In the inspect method, I reposition and resize a semi-transparent fixed positioned element over the element returned from the event target. B…
Make element scroll slower (Parallax)
I have an element on my page absolutely positioned. Im trying to write a snippet of jQuery to make that element scroll at a slower rate than the rest of the elements on the page. I’ve written this so far but cannot seem to get it too work at all. Has anybody experience with this and if so would you
Are JavaScript Arrays actually implemented as arrays?
The difference between a JavaScript Array, and Object is not very big. In fact it seems Array mainly adds the length field, so you can use both Arrays and Objects as numeric arrays: So my questions is, in popular JavaScript engines (V8, JavaScriptCore, SpiderMonkey, etc.), how is this handled? Obviously we do…
Check if date is less than 1 hour ago?
Is there a way to check if a date is less than 1 hour ago like this? Also, different question – is there a way to add hours to a date like this? Answer Define then you can do To get one hour from a date, try
How do website heatmaps get accurate data?
There are services like crazyegg.com that show you where visitors are resting their mouse cursors on your web page. My question is, given that people have different screen widths how can they be sure that my x coordinate is the same position on the page as another persons x coordinate? Meaning, two people may…
How to check whether multiple values exist within an Javascript array
So, I’m using Jquery and have two arrays both with multiple values and I want to check whether all the values in the first array exist in the second. For instance, example 1… Array A contains the following values 34, 78, 89 Array B contains the following values 78, 67, 34, 99, 56, 89 This would re…