How to encode the filename parameter of Content-Disposition header in HTTP?

Web applications that want to force a resource to be downloaded rather than directly rendered in a Web browser issue a Content-Disposition header in the HTTP response of the form: Content-Disposition: attachment; filename=FILENAME The filename parameter can be used to suggest a name for the file into which the resource is downloaded by the browser. … Read more

Are the PUT, DELETE, HEAD, etc methods available in most web browsers?

I’ve seen a couple questions around here like How to debug RESTful services, which mentions: Unfortunately that same browser won’t allow me to test HTTP PUT, DELETE, and to a certain degree even HTTP POST. I’ve also heard that browsers support only GET and POST, from some other sources like: http://www.packetizer.com/ws/rest.html http://www.mail-archive.com/[email protected]/msg13518.html http://www.xml.com/cs/user/view/cs_msg/1098 However, a … Read more

Is there a way to detect if a browser window is not currently active?

I have JavaScript that is doing activity periodically. When the user is not looking at the site (i.e., the window or tab does not have focus), it’d be nice to not run. Is there a way to do this using JavaScript? My reference point: Gmail Chat plays a sound if the window you’re using isn’t … Read more

WebSockets vs. Server-Sent events/EventSource

Both WebSockets and Server-Sent Events are capable of pushing data to browsers. To me they seem to be competing technologies. What is the difference between them? When would you choose one over the other? 6 s 6 Websockets and SSE (Server Sent Events) are both capable of pushing data to browsers, however they are not … Read more

What is JavaScript’s highest integer value that a number can go to without losing precision?

Is this defined by the language? Is there a defined maximum? Is it different in different browsers? 22 s 22 JavaScript has two number types: Number and BigInt. The most frequently-used number type, Number, is a 64-bit floating point IEEE 754 number. The largest exact integral value of this type is Number.MAX_SAFE_INTEGER, which is: 253-1, … Read more