I’m trying to save my HTML file in Chrome when the user presses ctrl + s keys but Chrome is crashed. (I want to download just the source code of my HTML file) I read that it happens because my file is bigger than 1.99M.. In the first attempt (before I knew about the crashing in Chrome): The second attem…
Tag: javascript
Browser-Based SRP without Java
I am considering implementing the Secure Remote Password protocol to conduct a zero-knowledge password proof between the browser and my web application. The SRP website provides an example, but it requires java to perform calculations. I am wondering whether it is possible to implement SRP using javascript wi…
How to get all pairs of array JavaScript
I need to call function with all avaliable pairs of array elements. Like this: Answer You should try to show us that you’ve solved the problem yourself instead of just asking us for the answer, but it was an interesting problem, so here: http://jsfiddle.net/J3wT5/
What version of IE doesn’t pass the event as argument to listeners?
As some old versions of IE didn’t provide the event as argument to event listeners, we got used to (event||window.event). In order to decide whether it can still make some sense to have this in a modern library, I tried to look at what versions were concerned but I couldn’t find this information. …
Javascript – convert youtube/vimeo url’s into embed versions for use on a forum comment feature
Trying to make something similar to facebook. I’ve created this javascript url pattern converter. Something like this could be triggered just as the user clicks on the submit button for a forum post – convert url’s into embed html variants. Any ways to improve this? http://jsfiddle.net/88Ms2…
Aren’t promises just callbacks?
I’ve been developing JavaScript for a few years and I don’t understand the fuss about promises at all. It seems like all I do is change: Which I could use a library like async for anyway, with something like: Which is more code and less readable. I didn’t gain anything here, it’s not s…
Google Form on Submit get values and format the time
I am using Google Apps Script with a Google form. When the user submits the Google Form I get a value from a question. I then take that value and make it a date object, from what I saw on this post about daylight savings I use that to determine the timezone. I run the date object through Utilities.formatDate …
moveend event fired many times when page is load with Leaflet
I need to do some operations when the map is paned or zoomed, so I attached a callback to the event moveend. It works fine, but when the page is load the event is fired three times and I don’t know why. Probably because during its creation the map is moved. To avoid this i tried to wait the load
Create an array with all numbers from min to max without a loop
I have two numbers, min and max, and I want to create an array that contains all number between them (including min and max). The most obvious approach is to use a for loop for this, and push the single values onto an array. Nevertheless, this seems to be a quite naive approach, i.e. it’s imperative pro…
Validation for 10 digit mobile number and focus input field on invalid
I need the code for validating email and mobile number in jQuery and also focus() on that particular field where validations are not satisfied. This is my query Answer for email validation, <input type=”email”> is enough.. for mobile no use pattern attribute for input as follows: you can che…