I’m trying to find some hints where I should search for this topic but I’ve nothing found – and I spent many hours on this. I’m also trying to get the current coordinates out of the current displayed viewport from the OpenLayers map to add only these vectors that are in the current bou…
Convert slug variable to title text with javascript
I’m trying to do something that would be similar to turning a url slug-like variable into text that could be used for a title. So, I have a variable for example that is like this: I’d like to not use a regex to do this if possible somehow, but I don’t think there’s a way to do it witho…
Cross-domain connection in Socket.IO
Is it possible to use Socket.IO in a cross domain manner? If so, how? The possibility is mentioned around the web but no code examples are given anywhere. Answer Quoting the socket.io FAQ: Does Socket.IO support cross-domain connections? Absolutely, on every browser! As to how it does it: Native WebSockets ar…
DOM change event for Opera
So far I found how to do it in Chrome, the DOMSubtreeModified event: Is there a JavaScript/jQuery DOM change listener? Apparently it works in Firefox and IE 9 too. Do you know solutions for detecting DOM changes in other browsers such as Opera? And maybe older versions if IE, because I’m sure the event …
Calling ASP.NET MVC Action Methods from JavaScript
I have sample code like this: How can I write JavaScript code to call the controller action method? Answer Use jQuery ajax: http://api.jquery.com/jQuery.ajax/
Event propagation, overlay and drag-and-drop events
I want to overlay a div over the viewport when the user drags a file onto the window. However, I’m having trouble with the event propagation. When I set the overlay to display: block it appears to fire off a dragleave event and then another dragenter and then another dragleave again, so it’s alway…
Select box truncating text when body font size changed via javascript on document ready in IE 9
IE 9 is behaving quite strangely for me. I’ve got a page font-size changing control that saves the users setting and then in the document ready sets the body font-size to that size. It works fine, the issue is, when a page with dropdowns loads, in IE 9, sometimes the text is cut off. I’ve simplifi…
Chrome extension to read HTTP response
I have this Chrome extension that modifies the header of requests before sending them. I now would like to be able, within the same extension, to check the header of the response. I searched throughout the Chrome Extension APIs but I couldn’t find anything of interest. This is the code I use for modifyi…
How to select an input element by value using javascript?
I’ve seen it’s jquery equivalent: But how do you select it using pure javascript (no jQuery). Thanks for all the responses so far but I’m sure if it is working correctly, I need to change the value of the input into something else. I though I could do this by But it appears to be not that ea…
Uncaught TypeError: Illegal invocation in JavaScript
I’m creating a lambda function that executes a second function with a concrete params. This code works in Firefox but not in Chrome, its inspector shows a weird error, Uncaught TypeError: Illegal invocation. What’s wrong with my code? Answer The console’s log function expects this to refer t…