Javascript versioning to avoid caching, difference in these practices?

Using an updated querystring is a bad solution. See what Steve souders has so say about it: http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ The ideal method is to rename the file itself. Some people prefer using the time stamp of the last modification date, which i think is a problem. In modern web development you really need to optimize your page … Read more

How to detect Safari, Chrome, IE, Firefox and Opera browser?

Googling for browser reliable detection often results in checking the User agent string. This method is not reliable, because it’s trivial to spoof this value.I’ve written a method to detect browsers by duck-typing. Only use the browser detection method if it’s truly necessary, such as showing browser-specific instructions to install an extension. Use feature detection when possible. Demo: https://jsfiddle.net/6spj1059/  Run … Read more

How to remove spaces from a string using JavaScript?

This? Example  Run code snippetExpand snippet Update: Based on this question, this: is a better solution. It produces the same result, but it does it faster. The Regex \s is the regex for “whitespace”, and g is the “global” flag, meaning match ALL \s (whitespaces). A great explanation for + can be found here. As a side note, you could replace the content between the … Read more

Javascript versioning to avoid caching, difference in these practices?

Using an updated querystring is a bad solution. See what Steve souders has so say about it: http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ The ideal method is to rename the file itself. Some people prefer using the time stamp of the last modification date, which i think is a problem. In modern web development you really need to optimize your page … Read more

How to detect Safari, Chrome, IE, Firefox and Opera browser?

Googling for browser reliable detection often results in checking the User agent string. This method is not reliable, because it’s trivial to spoof this value.I’ve written a method to detect browsers by duck-typing. Only use the browser detection method if it’s truly necessary, such as showing browser-specific instructions to install an extension. Use feature detection when possible. Demo: https://jsfiddle.net/6spj1059/  Run … Read more

How can I get file extensions with JavaScript?

Newer Edit: Lots of things have changed since this question was initially posted – there’s a lot of really good information in wallacer’s revised answer as well as VisioN’s excellent breakdown Edit: Just because this is the accepted answer; wallacer’s answer is indeed much better: My old answer: Should do it. Edit: In response to PhiLho’s comment, use something like:

Does parseDouble exist in JavaScript?

It’s not possible to natively deal with a 21-digit precision number in JavaScript. JavaScript only has one kind of number: “number”, which is a IEEE-754 Double Precision (“double”) value. As such, parseFloat in JavaScript is the equivalent of a “parse double” in other languages. However, a number/”double” only provides 16 significant digits (decimal) of precision and so reading in a number with 21-digits will lose the 5 … Read more