There’s a blog post out there from Fritz Onion floating around about generating a fresh request from IE. I thought some of you mind find this helpful. Sorry it’s long, I wanted to make sure the problem was clear before I went on trying to fix it. If you have questions come see me.
The problem:
If you have a page that has posted back how do you generate a fresh request of that page, as if it were your first visit to that page? If you click the “refresh” button you simply get a dialog asking, “The page cannot be refreshed without resending the information. Click Retry to send the information again, or click Cancel to return to the page that you were trying to view." If you click “Retry” you get the page with the information re-posted. If you click cancel, you’re taken back where you came from, no fresh request.
Possible fixes:
I would solve this problem by copying the url, going somewhere else, then pasting the url back in, thus generating a fresh request for the page. In development this can take some time and it’s just dumb to have to do this.
A better fix:
On any page where you want to generate a fresh request simply change the case of one of the letters. IE will process this as a new request and get you a fresh request.
Test this out:
- Go to http://www.genesishealth.com/physicians/index.aspx
- Search on the last name “Anderson”
- Now say you want to go back to an empty search (the first time you were to visit a page). How do you do it? Try the fix by changing case, it works nicely. Change index.aspx to index.aspX and you’ll see a fresh page is requested.
My spin:
Michael introduced me to bookmarklets awhile ago. If you are unfamiliar basically a “flaw” (or feature depending on who you talk to) in IE allows you to run javascript in the address bar. A bookmark simply replaces the address bar with what it stores in the url property. If you type javascript in a bookmark url IE will happily run the javascript. Don’t believe me? Crack open IE and type javascript:alert("Hello World") and hit “Go” or “Enter”.
I’ve created a bookmarklet that simply changes the case of the last character in your Url.
To create the bookmarklet do the following:
- Make sure the Links toolbar is visible (ensure View/Toolbars/Links is checked).
- In the Favorites menu, select Add to Favorties...
- Type "Real Refresh” (or whatever you want) in the Name field.
- In the Create In box, select the Links folder. Click OK.
- Copy the text of the bookmarklet, below
javascript:var loc=document.location.href;var lastChar = loc.substr(loc.length - 1); if (lastChar == lastChar.toUpperCase()){lastChar=lastChar.toLowerCase()}else{lastChar = lastChar.toUpperCase()};document.location.href=loc.substr(0,loc.length-1) + lastChar;
- Right-click on the new "Real Refresh" link in the Links bar, and select Properties.
- Paste the bookmarklet text into the URL field. Click OK.
Possible caveats:
If you have a query string it, this bookmarklet will handle fine, this script will keep it but will modify the last character of any string passed to it. That being the case the last value could have a goofy value, ie “...Name=TiM” So if you're reading in data that is case sensitive, you need to be wary. If this is a problem, I would suggest modifying the script to find the .com or and change it to .coM or something insignificant like that.