Posts Tagged ‘IE’

Servlet Filter to prevent No-Cache

March 27th, 2011 No comments

In one of the posts, I had talked about IE caching AJAX calls. To solve this issue , you would have to modify response such that it informs browser not to cache the data coming from this server.

I am explaining it in plain old fashioned way of ServletFilter.

Below is the code for ServletFilter.

public class NoCacheFilter implements Filter {

private FilterConfig filterConfig = null;

public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;

public void destroy() {
this.filterConfig = null;

* Modifies the response. Sets the appropriate headers
* and invoke the next filter in the chain:
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {

HttpServletResponse httpResponse = (HttpServletResponse) response;

httpResponse.setHeader(“Cache-Control”, “No-cache”);
httpResponse.setDateHeader(“Expires”, 0);
httpResponse.setHeader(“Pragma”, “No-cache”);
chain.doFilter(request, response);


This is helpful for browsers like IE which Cache your data by default and do not display fresh data. This is one of the situations when you are working with JSON REST web services in which you might to pull and display fresh data.

Categories: Programming / tutorials Tags: , ,

Cross domain Scripting comes to haunt again

March 6th, 2011 No comments

In my last posts I had talked about Cross domain scripting issue with Firefox and how to solve cross domain scripting issues on tomcat

But looks like the issue has not been completely resolved. I have used the CORS filter solution as we are working on tomcat but have some problems in exception scenarios

Problem Statement:

I am trying to make a call to a REST service and trying to catch an 404 or 200 condition returned by REST and show an appropriate message to user based on error code.

My url in browser is http://localhost:8080/myapp/test.html

The code inside is

<script type=”text/javascript” charset=”utf-8″ src=”json2.js”></script>
<script type=”text/javascript” charset=”utf-8″ src=”jquery-1.4.4.min.js”></script>

function invokeFunction()

var myService = null;
if (window.XMLHttpRequest) //for mozilla
myService = new XMLHttpRequest();

if ( typeof myService.overrideMimeType != ‘undefined’)
else if (window.ActiveXObject) //for IE
myService = new ActiveXObject(“Microsoft.XMLHTTP”);

var serviceUrl = ““; Read more…

IE caching Ajax calls

March 2nd, 2011 No comments

If you have been trying to make a REST call from your javascript or jsp page, you might have found that in firefox(FF) and Safari there is a call made to server every time . But this does not happen in IE.

This is the scenario I had

I had script file client.js which was making a rest call to get some data.

First time I could see the results but then with every other subsequent call, there was no change in state, although the data should have changed.

Now this can be fixed by multiple ways

Option 1:

Change the browser settings. To  do this you have to go to


and change the settings from Automatically to Every Visit to page

This will resolve the issue.

Option 2:

Change from GET to POST

Option 3 :

Add a timestamp at end of url which will looking at which server will think it is a new URL.

Read more…

How to run multiple versions of IE on same machine ?

October 11th, 2010 4 comments

A very common problem faced when developers want to see how they can test the application in multiple browser versions especially IE where in each version breaks some thing in application. It happens with me and so it might be happening with other users as well.

Options 1 : IE Tester

IETester is a free WebBrowser that allows you to have the rendering and javascript engines of IE9 preview, IE8, IE7 IE 6 and IE5.5 on Windows 7, Vista and XP, as well as the installed IE in the same process

Option2  : Multiple IE Installer

Install Multiple IE installer

Run IE6 , IE7 and IE8 side by on using Windows 7 RTM. Here is a nice blog post on how to do this

run IE6 , IE7 and IE8 .

Multiple IE installer is no longer supported and maintained. So take you chance.

Option 3

Internet Explorer Application Compatibility VPC Image

This is VPC Hard Disk Images for testing websites with different Internet Explorer versions on Windows XP and Windows Vista. You will download different virtual images on your machine and need to install them.

I have not tried it but will trust it as it is from Microsoft.

Option 4

Download and install Virtual Box.

This is free vitualization software for enterprise and home use.

Option 5

If you are migrating from IE6 to IE7 , then use this visual debugging tool.

Microsoft Expression Web SuperPreview for Windows Internet Explorer

Option 6

You can install Spoon plugin in your browser and check compatibility

Run IE6, IE7 and IE8 side by side

How to run IE only sites from Linux

June 11th, 2010 3 comments

Sounds stupid ? Why would you want to run IE from Linux ? Why not use Firefox or Chrome ?

But that is not always the scenario.

Reason no 1 : Web designers who use Linux need to test their site on IE . Do not forget IE still commands majority of browser market 59.95%. Can you afford to ignore IE .

Obviously not !

Reason no 2 : Organizations who have created IE only applications 7-10 years back and are now switching to Linux platform , do not want to spend time and money porting the application to new browsers.

So when confronted with this problem what can be done ?

Solution 1 :

If you have windows as your OS then you can use this fantastic plugin IE Tab for Firefox. I have tried this and our UI was pretty heavy bit worked perfectly fine with plugin. I think as of date, the developers are not supporting this plugin so you might not be able to find upgrade for latest version of Firefox.  There are other plugins similar to IE tab in firefox which you wanna try out.

Drawback : This does not work on Linux.

Solution 2: Read more…

Categories: Programming / tutorials Tags: ,