Weird Thoughts From Eric's Head

Categories : All | AJAX | BUSINESS | PERSONAL | PROGRAMMING | BOOK REVIEW

Ajax: Pop Up Blockers are an Ajax Developer Problem?

Well pop up blockers have been known to drive developers insane when they block windows that are needed in the application. Well I just found out that some pop up blockers are destroying the lives of Ajax Developers too. I never thought that would be the case until I saw it with my own eyes.

As I always mention, I write all of the clientside errors to the server log on my application so I can spot problems that I would never see. The other week I saw an error message saying I had a bad response from the server. This check is a regular expression that expects a correct format from the server. When it detects an incorrect format it dumps the message to the log.

So in my log I see the error message and responseText string returned from the server. To my surprise I saw a wonderful injected code of a pop up blocker. The pop up blocker which I could identify was the Proxomitron Anti-popup code. The other blocker code I saw was too generic to determine what one it was.

So that means if you are expecting a certain format to be returned from the server, it may not be the case since a pop up blocker may inject code into the XHR response. That is why I stress you have to validate the data coming from your server on the client before using it. Make sure it is what you expect!

This is just one more thing to add to your plate when you are developing an Ajax application. Outside parameters you can not test for and can not control, but do affect your user’s experiences.



Eric Pascarello
Coauthor of Ajax In Action
Moderator of HTML/JavaScript at www.JavaRanch.com
Author of: JavaScript: Your Visual Blueprint for Dynamic Web Pages


Eric, can you show us an example of what this looks like? What is the popup blocker doing to the response, exactly? Is it just changing a string like ".open" to something else?

EHF,

When I get a response back it should be a set string of numbers and such that is know to certain operations.

some basic example would be:

1,123,234;2,324,123;3,12;

Now instead of getting that my response was showing this in my log:

Client Error Message/Detail: ERROR: BAD RESPONSE FROM SERVER: 
<!--//--><script>var PrxLC=new Date(0);var PrxModAtr=0;
var PrxInst; if(!PrxInst  ) PrxRealOpen=window.open;
function PrxOMUp(){PrxLC=new Date();}function PrxNW(){
return(this.window);} function PrxOpen(.......

In the basic sense it is injecting the script into the page when it is requested. So the response being returned in my case would be:

--injected pop up code--My normal response I expect.

Now to get around that could be a little tricky depending on what you are doing. Could be as simple as placeing a wrapper around the response and getting it with some JS manipulation.

This post really goes in hand with my post back on Feb.13th with session expiring: http://radio.javaranch.com/pascarello/2006/02/13/1139887007801.html. The reponse coming back will be the login page. A lot of checks are needed and frameworks do not handle this!

Eric Pascarello
We are living in an internet time where you can not go around popups without a decent popup blocker. Too bad, but I think it will only get worse by time. Popups should be stopped and people distributing these popups for advertising needs should be fined. They just keep spamming us with their advertising. What if you would receive as much mail daily in your mailbox at home as you would have popups on a daily basis ? Yes, you would complain to the authorities, but where do you go online ?? My place for free popup blockers is therefore: http://www.freespamfilter.nl/uk/popup-blocker.htm They always have the latest and best popup blockers available and have good reviews of all popup blockers. Cindy


Add a comment

Title
Body
HTML : b, i, blockquote, br, p, pre, a href="", ul, ol, li
Math Quiz 9 + 4 = (Helps stop blog spam)
Name
E-mail address
Website
Remember me Yes  No 

E-mail addresses are not publicly displayed, so please only leave your e-mail address if you would like to be notified when new comments are added to this blog entry (you can opt-out later).

TrackBack to http://radio.javaranch.com/pascarello/addTrackBack.action?entry=1140795030562