javascript

What are best practices for preventing stale CSS and JavaScript

I'm researching this for a project and I'm wondering what other people are doing to prevent stale CSS and JavaScript files from being served with each new release. I don't want to append a timestamp or something similar which may prevent caching on every request. I'm working with the Spring 2.5 MVC framework and I'm already using the g...

Reformatting JavaScript/JScript code?

I've got a JScript error on my page. I know where the error's happening, but I'm attempting to decipher the JScript on that page (to figure out where it came from -- it's on an ASPX page, so any number of user controls could have injected it). It'd be easier if it was indented properly. Are there any free JScript reformatters for Window...

Referencing Google's V8 engine from a .NET app

I'm building a .NET 3.5 application and have the need to evaluate JS code on the server - basically a user provided rule set that can work within a browser or on the server. Managed JS is not an option, because the JS code would be provided at runtime. Aptana's Jaxer is also not an option. So I was looking into using a build of the V8 en...

Customizing pop up background color with IE7 open popups in new tab setting

I have a pop up on my page that I want to have a white background if it is opened in a new tab according to the user's settings in IE7 to open pop ups in new tabs. Is it possible to customize this, or am I stuck with a black background. Also, can I set the position of the pop up if it is opened in a new tab. For instance, if the pop up...

Bypass IE "The webpage you are viewing..." pop up

Is there a way to bypass the following IE popup box: The webapge you are viewing is trying to close the window. Do you want to close this window? Yes|No This is occurring when I add window.close() to the onclick event of an asp.net button control ...

Java based Swing Browser should support JavaScript

In my company, I am implementing a java based html browser. I found a lot of tools to generate complete browsers only in Swing which are looking like Mozilla. But I was not able to find a browser which supports JavaScript. The browser I will implement should execute JavaScript inside the HTML sides. Do you know of a tool that supports t...

ASP.NET CSS Adapters without the crazy js injected to "help you"

Hi, the object of the game in this case is to use a Treeview with a sitemap provider - and implement using CSS. I'm guessing the way to do this is with the CSS adapter kit. I've plugged in the adapters using the DLL implementation and there i get my basic treeview but it seems to pull in all sorts of js that lets me click on nodes and ...

Replacing a word with another word zero or more times in javascript using regular expressions

I have a word : [lesserthen] , that I need to replace with < zero or more times in a string. I'm using the String.replace method to do so. But the word is only replaced one time in the string, I need to be replaced more then one time. I'm very weak with regular expressions and I'm interested to find a solution for this problem. Here i...

How can I attach a .NET delegate to an mshtml event?

I'm working on an extension (BHO) for Internet Explorer, and having trouble attaching a .NET delegate to the mshtml objects to catch DOM events. I've tried using the events published by the IHTMLElementEvents2_Event, ... interfaces, and that works, but only if I specify the correct type for the DOM element whose events I want to catch. ...

Instantiate DataContract in javascript when using WCF service with ScriptService

I have a simple WCF service that I'm exposing using a .svc. The service has some related DataContract classes that are used with the ServiceContracts. When calling a method that gets some data, the json that comes back has all the properties just as you'd expect. My question is how can I get a new instance of one of these DataContract ...

How to detect when the height of your page changes?

I have a javascript heavy app which has widgets like autocomplete dropdowns and tabs and so forth. Sometimes when dropdowns appear and disappear, or when you switch between tabs, it changes the height of the document. This can cause annoyances if the scrollbar appears and disappears rapidly, because it shifts the page. I would like to de...

How to create a custom "confirm" & pause js execution until user clicks button?

Ok, I'm doing a bunch of RIA/AJAX stuff and need to create a "pretty", custom confirm box which is a DIV (not the built-in javascript confirm). I'm having trouble determining how to accomplish a pause in execution to give the user a chance to accept or decline the condition before either resuming or halting execution. (depending upon the...

Easiest way to split string into Key / value

What's the best way to extract the key and value from a string like this: var myString = 'A1234=B1234'; I originally had something like this: myString.split('='); And that works fine, BUT an equal (=) sign could be used as a key or value within the string plus the string could have quotes, like this: var myString = '"A123=1=2=3=4"...

Javascript to detect Skype?

Is it possible for some Javascript to detect whether Skype is installed or not? The reason I ask is that I'd like to change a link's href based on that: if Skype isn't installed, show a popup explaining what Skype is and how to install it, if it is installed, change the link to skype:my.contact.name?call so the click will start a call. ...

getImageData in Firefox 3 causing NS_ERROR_DOM_SECURITY_ERR

I'm trying to develop an application that will use getImageData in javascript in Firefox 3, but I am getting a "NS_ERROR_DOM_SECURITY_ERR" on the getImageData call. The javascript and the image are both currently being served from by hard drive, which is apparently a security violation? When this is live they will both be served from the...

JQuery Loop over JQueryObjects

Hi, I have a method, which will accept a parameter of a JQuery Object and will calculate totals for a section. So if you give it a JQuery Object of a div containing the section it will calculate a total for it so you can do this: var $totalcompletion = CalculateSectionCompletion(jQuery("#Section1")); Now I have multiple divs with the...

IE6 sometimes not loading stylesheet

Hi We are having a problem where IE6 (the only browser we have noticed this happening on) seems to be caching an empty version of our main stylesheet. The only way to resolve the problem is to request the stylesheet directly by typing the its url directly into the browser, and then when you refresh the page, it will appear with the sty...

Javascript error... I think

I've been trying to fix this for two hours straight and I can't figure it out. onclick = "location='exceltest.asp?vanjaar=<%=vanjaar%>&vanmaand=<%=vanmaand%>&vandag=<%=vandag%>&totjaar=<%=totjaar%>&totmaand=<%=totmaand%>&totdag=<%=totdag%>'" That line of code is in an < input type="button" /> attribute. The button links to a page wher...

Why do I get an error using moveTo in JavaScript?

I am opening a new window from a button using var myWindow = window.open(...). I then want to move that window to the correct location on the screen. I use myWindow.moveTo(10,10) to do this but I get an Access Denied error. The window I open contains information from another server to the one I am executing on. When it isn't, the window...

JQuery detecting Programatic change event...

If i do jQuery(expr).change( function), then I can get an event function to fire when the user makes a change to the value. Is it possible to get this to fire if it's changed programatically, ie if I call jQuery(expr).val("moo"). or if some Plain old JavaScript changes it's value? Thanks for any help. ...