I had an issue with Apache2 improperly serving a JavaScript file which I seem to have fixed by making sure the file was terminated with a new-line character… this was really hard to diagnose and resolve! The behaviour in Firefox was that the file just didn’t finish to download, whereas the Apache2 logs indicated a 200 result… I think it may have had something to do with automatic compression, which is a dark art that I do not understand (mumbles something about mod deflate…).
Tag Archives: javascript
Native HTML5 Drag and Drop
Found an article on Native HTML5 Drag and Drop…
window.resizeTo( … )
See here:
- You can’t resize a window or tab that wasn’t created by window.open.
- You can’t resize a window or tab when it’s in a window with more than one tab.
- Also, even if you create window by window.open(…) it is not resizable by default …see 4.
- To make window created by window.open() resizable, you must open it with resizable feature
myExternalWindow = window.open("http://example.com", "myWindowName", "resizable"); myExternalWindow.resizeTo(500,500); //resize window to 500x500
HTML glow effects
Found some cool glow effects. Couldn’t actually get them to work in my context, but it’s the thought that counts.
Passing selected value into HTML select onchange handler
So you have a <select> element and you want to call a handler, but you need to pass the selected value to the handler because you have multiple instances of the same <select> and can’t access them by ID (because there is many, one of which will have the new selected value, but you don’t know which). The solution is to pass in the newly selected value, like this:
<select onchange='handle_change( this.value )'>
Easy-peasy!
Multiline strings in JavaScript
Read an interesting article about multiline strings in JavaScript over on Stack Overflow, which referenced the Google JavaScript Style Guide which I thought was interesting.
jQuery htmlspecialchars equivalent to encode text as HTML
Found this which said:
$('<div/>').text('This is fun & stuff').html();
JavaScript values, variables, and literals
Found myself reading about values, variables, and literals in JavaScript.
Array splice method
Found myself looking up the syntax of the Array splice method.
Text Escaping and Unescaping in JavaScript
Found a handy web-based utility for encoding/escaping text in JavaScript: Text Escaping and Unescaping in JavaScript.