javascript

GUI apps in javascript without a browser?

I would like to use javascript to develop general-purpose GUI applications. Initially these are to run on Windows, but I would like them to ultimately be cross-platform. Is there a way to do this without having to make the application run in a browser? ...

JavaScript Chart Library

Would anyone recommend a particular JavaScript charting library - specifically one that doesn't use flash at all? ...

Detect via javascript whether Silverlight is installed

Is there a javascript function I can use to detect whether a specific silverlight version is installed in the current browser? I'm particularly interested in the Silverlight 2 Beta 2 version. I don't want to use the default method of having an image behind the silverlight control which is just shown if the Silverlight plugin doesn't loa...

Problem with Asp.Net RequireFieldValidator and Javascript WYSIWYG

I am using the open source Javascript WYSIWYG from OpenWebWare and Asp.Net RequiredFieldValidator on the TextBox which I am calling the WYSIWYG for. Everything works fine, but the first time I try to submit the form, I get the server-side RFV ErrorMessage "Required", but if I submit a second time, it goes through. Am I missing somethin...

XSS Blacklist - Is anyone aware of a reasonable one?

As a temporary quick fix to mitigate the major risk while working on the permanent fix for XSS Vulnerability in a very large code base, I'm looking for a pre-existing XSS prevention blacklist that does a reasonable job of protecting against XSS. Preferably a set of Regular Expressions. I'm aware of plenty of cheat sheets for testing and...

Updating server-side progress on Rails application

I want to upload and then process a file in a Ruby on Rails app. The file upload is usually quite short, but the server-side processing can take some time (more than 20 seconds) so I want to give the user some indicator - something better than a meaningless 'processing...' screen. I'm trying to use the following code in the view <%= p...

What's the best way to detect if a given Javascript object is a DOM Element?

Say for instance I was writing a function that was designed to accept multiple argument types: var overloaded = function (arg) { if (is_dom_element(arg)) { // Code for DOM Element argument... } }; What's the best way to implement is_dom_element so that it works in a cross-browser, fairly accurate way? ...

How do you get a spreadsheet to open Excel instead of a browser window?

If you call javascript window.open and pass a url to a .xls file it open on some machines in the browser window. How can you force it into Excel? ...

Javascript Try/Catch

I've got a function that runs a user generated Regex. However, if the user enters a regex that won't run then it stops and falls over. I've tried wrapping the line in a Try/Catch block but alas nothing happens. If it helps, I'm running jQuery but the code below does not have it as I'm guessing that it's a little more fundamental than th...

Difference between Array.slice and Array().slice

I am going through John Resig's excellent Advanced javascript tutorial and I do not thoroughly understand what's the difference between the following calls: (please note that 'arguments' is a builtin javascript word and is not exactly an array hence the hacking with the Array.slice instead of simply calling arguments.slice) >>> argument...

Can you read the body of a reply to a POST request from flash?

I am trying to POST a file to a server that replies with some basic status information in the body. Everything is easy from javascript but I was wondering if I could read the status information from the reply using flash. That way I can use the multifile picker flash provides and send several files at once. BTW would it work with PUT? ...

How can I get jQuery unclick() and unbind() to work?

I want to attach an click event to a button element and then later remove it, but I can't get unclick() or unbind() to do anything. In this example below, the button is tan and the click event works. window.onload = init; function init() { $("#startButton").css('background-color', 'beige').click(process_click); $("#startButton"...

How many people disable JavaScript?

What is the market penetration like for JavaScript? I know of many articles (all a few years old) that have investigated how big a percentage has JavaScript disabled. I am developing a very JavaScript-heavy site now, and would very much like to know how large a percentage of the world browse without JavaScript enabled. ...

Hidden features of Greasemonkey

What are some of the lesser-known but useful features and techniques that people are using in their Greasemonkey scripts? (Please, just one feature per answer.) Similar threads: Hidden Features of JavaScript Hidden Features of Java Hidden Features of C++ Hidden Features of C# ...

How to detect if JavaScript is disabled?

There was a post this morning asking about: How many people disable javascript. Then I began to wonder what techniques might be used to determine if the user has it disabled. Anyone know of some short/simple ways to detect if Javascript is disabled? my intention is to give warning that the site is not able to function properly without th...

Client-side detection of HTTP request method

Is it possible to detect the HTTP request method (e.g. GET or POST) of a page from JavaScript? If so, how? ...

Is there a good way of securing an ASP.Net web service call made via Javascript on the click event handler of an HTML button?

The purpose of using a Javascript proxy for the Web Service using a service reference with Script Manager is to avoid a page load. If the information being retrieved is potentially sensitive, is there a way to secure this web service call other than using SSL? ...

When onblur occurs, how can I find out which element focus went *to*?

Suppose I attach an onblur function to an html input box like this: <input id="myInput" onblur="function() { ... }"></input> Is there a way to get the ID of the element which caused the onblur event to fire (the element which was clicked) inside the function? How? For example, suppose I have a span like this: <span id="mySpan">Hello...

How to use javascript with an asp.net dropdownlist control?

I don't currently use ajax.net though I would be open to it if it is the only solution. I have a auto-complete control on screen that I am using to populate a asp.net dropdownlist with values through javascript (jQuery). I have had to use EnableEventValidation="false" to allow this. After I add my options to the select and the form is po...

Replace text inside a DIV element

I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available. <div id="panel"> <div id="field_name">TEXT GOES HERE</div> </div> Here's what the function will look like: function showPanel(fieldName) { var fieldNameElement = document.getElementById...