Skip to content
Advertisement

How to play a notification sound on websites?

When a certain event occurs, I want my website to play a short notification sound to the user. The sound should not auto-start (instantly) when the website is opened. Instead, it should be played on demand via JavaScript (when that certain event occurs). It is important that this also works on older browsers (IE6 and such). So, basically there are

Convert date to another timezone in JavaScript

I am looking for a function to convert date in one timezone to another. It need two parameters, date (in format “2012/04/10 10:10:30 +0000”) timezone string (“Asia/Jakarta”) The timezone string is described in http://en.wikipedia.org/wiki/Zone.tab Is there an easy way to do this? Answer Here is the one-liner: This is the MDN Reference. Beware the caveat: function above works by relying

Detect keypress combination series with Javascript

For the Easter holiday, I’m wanting to have a little surprise “Easter Egg Hunt” on a site I develop for. Two of these five Easter Eggs I’m hiding will be keypress ordained. This won’t be like a “Press CTRL and TAB at the same time” type deal but will be a “Pres UP three times and then RIGHT three times”

Get data from fs.readFile [duplicate]

This question already has answers here: Why is my variable unaltered after I modify it inside of a function? – Asynchronous code reference (7 answers) Closed 6 days ago. Logs undefined, why? Answer To elaborate on what @Raynos said, the function you have defined is an asynchronous callback. It doesn’t execute right away, rather it executes when the file loading

Send response to all clients except sender

To send something to all clients, you use: To receive from clients, you use: How can I combine the two so that when recieving a message on the server from a client, I send that message to all users except the one sending the message? Do I have to hack it around by sending the client-id with the message and

How does a JavaScript parser work?

I’m trying to understand how JS is actually parsed. But my searches either return some ones very vaguely documented project of a “parser/generator” (i don’t even know what that means), or how to parse JS using a JS Engine using the magical “parse” method. I don’t want to scan through a bunch of code and try all my life to

Remove Object from Array using JavaScript

How can I remove an object from an array? I wish to remove the object that includes name Kristian from someArray. For example: I want to achieve: Answer You can use several methods to remove item(s) from an Array: If you want to remove element at position x, use: Or Reply to the comment of @chill182: you can remove one

Resizing ‘iframe’ after inside content is loaded

I have an iFrame in which I am loading a page which uses ajax to load data after various page labels are clicked. Now I am using Javascript function to calculate loaded-data height for replacing iframe’s height which results into resizing iframe and thus avoids scrollbars. Now my problem is script gets called as soon as labels are clicked, but

Advertisement