In the onClick of a link that needs to do some heavy processing the webapplication would call a method like this:
onClick="setCurrentTaskOutcome('name','favwebcomic')"
Problem is, it takes the browser too long to even find the 'setCurrentTaskOutcome' method, the browser appears hung while the click event is slowly processed by IE. So putting more code in the setCurrentTaskOutcome function to alert the user would not help with the user feedback issue because they would still have to wait until the function was located and executed by the browser before any feedback would get presented.
My solution is:
onClick="confirm('Set User Params ?') != 0 ? setCurrentTaskOutcome('name','favwebcomic') : void(0);"
Now the browser will instantaneously prompt the user to confirm the operation, if they cancel the operation is not performed, if they confirm, then they at least now know the browser is processing their request instead of it just appearing hung.
To break it down, the confirm javascript function will return non-zero if they click ok, so the
confirm('Set User Params ?') != 0
Is a confirm window dialog and test to see if they click ok wrapped into one.
I use the tertiary operator '?' to perform the task if they clicked ok, or nothing if they clicked cancel.
This works in both IE and Firefox. However, IE7 was the only browser that seems to suffer from performance and responsiveness issues for this web application. IE7 is the required browser for the employees of the company that will use this, so I can't just tell them to use Firefox. What needs to start happening is if you work for a company that requires you to use IE, or maybe even makes using Firefox, Safari or Opera difficult for you (because they have IE7 specific web apps), find a new job. Life is too short to live with IE7.
No comments:
Post a Comment