IE6's back button and repost - asp.net-mvc

My website is an asp.net-mvc(beta1) website, fully validates and works in all browsers (except obviously in IE6 for this matter).
I can reproduce the error by doing the following:
Make a POST request with some parameters
From the results click one of the generated GET links
Pressing the "BACK" button from the resulted page.
Sometimes the back button does nothing (last request's page keeps on screen, status says "Done")
Sometimes a completely empty page is shown with the correct URL and the "Done" status
Sometimes the res://ieframe.dll/repost.htm page is shown with "Cannot find server" title.
I have yet to find the triggering factor..
I'm guessing IE is not caching anything there so it will re-post the url. Nothing seems to be hitting my controller though.
What is happening? How can I start to debug this or even better: fix this?

Implement POST+REDIRECT+GET?

IE won't re-post without prompting the user. If IE isn't caching the results page (check what cache headers you are sending it), you should get the repost prompt. I don't know why you'd get 'Server not found' instead - sounds like a confused IE installation. (Is it a multiple-IE setup?)
As cletus mentioned, post-redirect-get is generally desirable for successful post forms.

To analyze the traffic between browser and server you should put Fiddler in bewteen.
This way you'll find out if IE6 sends any request at all back to the server upon hitting the back button.

Related

surveymonkey popup not showing

I setup a wordpress blog and wanted to add a popup from surveymonkey. To simply test if it gets loaded I added the script within the footer.php before the closing body tag. Then I reloaded the page but the popup didn't appear, I tried the same with an empty html page where it did work.
Then I compared the developer console and it seems that not everything gets loaded. For some reason after the object has been loaded nothing else gets loaded. I even tried to add the script to another project (not wordpress) but it doesn't work either.
I also tried to setup a new collector and added the script tag again to my project. The popup has been loaded, but after I reloaded the page the same happens as before. It does work though when I use an embedded survey, instead of a popup survey.
Here are my results on firefox:
Any page
Empty page
What am I doing wrong here?
Wanted to add in the edit This is the correct answer but also I wanted to give context to why the default nature SurveyMonkey creates here is not good. If the end user activates the survey a single time the fact that it would not open again makes no sense and is a poor user experience.
The user would never know, if they closed the survey prematurely, that there was no reason that the activation of the survey could not be completed again.
SurveyMonkey allows for the survey to be taken again until it is completed and then the survey would explain to the user they have already completed the survey. This is a good user experience and sufficient.
***End edit
Just chiming in here, despite this being an old question. The previous answer is absolutely correct as the Survey Monkey popup will only display once and there's nothing you can do via the Survey Monkey interface to get it to show multiple times in a single browser session.
However, you can resolve this issue by adding the following JS above your Survey Monkey JS code:
<script>document.cookie = 'smcx_0_last_shown_at=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';</script>
This code clears a cookie created by the Survey Monkey pop up that keeps track of when it was last displayed, so it'll display every time the page is refreshed without the need to end the current browser session.
I know this is an old question, but I am posting a reply in case it helps someone else. It appears that Survey monkey limits the number of time the pop up shows to once per browser session.
I have tested in Chrome, Firefox & Edge and I was able to reproduce this behavior very consistently.
If either the embed or the pop has shown up once, the pop up will not show up a second time until you either close and re open the entire browser, or load the page in incognito/private browsing mode. But you will still need to close and re open the private/incognito browser window/tab each time you reload the page containing the pop up.
As of yet, I have not found an option within the Survey Monkey interface to disable this behavior for the pop up survey. Note that the embed survey does not suffer from this.

what are the reasons to have a waiting time before redirecting a page?

Quite some pages around the web have a waiting time period before redirecting you to the "correct" url.
Sometimes, they are downloading pages that make you wait a few seconds before the download starts, other times, they are simple redirects for when urls have changed for whatever reason, etc.
In most cases they also provide a direct link to the destination url, and mention "if your page doesn't reload automatically, click this link" (or something like that).
My question is, What is the reason of waiting? Why not to simply redirect immediately? what are the "benefits" of waiting?
The only reason i can think of is when the page has moved, and you notify the user so they, for instance, may change they bookmarks or something.
But in most other cases, the user just don't want to wait and doesn't care. So if they already provide the direct link anyway, (so the user can click it ASAP), why not to simply redirect immediately, and make it 'transparent' to the user?
So what are the real reasons to wait for redirects? and in which cases they apply?
If there's a noticeable delay, it usually means that JavaScript is being used.
As far as I know, there isn't any actual use for it. One difference however, is how search engines handle it. If it returns a 200 (OK) status code, the search engines may index it, if it has suitable content. HTTP redirects are never indexed (just their destinations).
For temporary flexible redirects (like I'm feeling lucky) the server should issue a 302 response.
If it's moved permanently, the server should respond with 301. This code also means that the browser should cache the redirection indefinitely, which works like updating a bookmark.

Url opens only on clicking link

Is there a way to ensure that a url successfully loads page only on clicking the link provided on a page and preventing url to open if the url is copy pasted in the browser address bar and Enter key is pressed ?
Edit
Session variables is the answer .. very silly question
You can't. Its a browser function and you don't have any control over it.
Users can't be outright prevented from this.
You can try to make it tough though, for example through hidden POST data or through a "proxy" link which acts as a gateway to your page. Session variables come to mind in this case, since you have effectively moved the locking logic server-side.

Jquery Mobile Logon Loop

Knocked-out a simple jQuery Mobile site with [logon -> index -> content] pages.
If I use the back button to the logon page, I can't escape no matter what I do - forward, back, filling it in, nothing.
I'd like to remove the #logon page from the navigation, so you cannot get back to it without typing it in, or logging out - any advice?
Easiest way to keep a page from showing up in history (with jquery mobile) is show that page in a dialog. This model works particularly well in situations where the content that would be in a dialog is either tangential to the main content or some sort of interrupt (which the login process is). See an example here. DISLAIMER: this is not the right way to implement content like this in the long run, it is only meant to show the effect of using a dialog in a login process to bypass insertion into history.
Another (more manual) route would be to use the a normal jqm page and do your login by way of an ajax posting. If the response came back as successful, then use location.replace() to remove the the current (logon) page from history.
I ended up removing the ajax navigation full stop and sticking to manual, not as pretty but headaches avoided!

Alternative way of Page.IsPostBack

I am into iPhone, Android and Blackberry web programming. I am struck into an issue in which i either need to stop refresh of page (which according to blogs is not possible) or i need to just refresh the page rather than submitting.
I have used basic HTML controls not ASP.Net server controls, so Page.IsPostBack cannot be used to differentiate between page refresh and a postback.
Alternatives that i have tried:
The root of the issue is that : Having used Request.Form Collection which are read only and are only updated on a postback. So, on a page refresh the Request.Form collection is having previous values and thus submits according to previous request.
I have tried using cookies as found in this link: http://hi.baidu.com/cxyking/blog/item/508872346135283c5ab5f53c.html
It is able to detect a page refresh only after it has already loaded. While my requirement is that i need to detect page refresh before the original page has been unloaded.
I tried to use OnBeforeUnload to display some warning message. But, this only works in desktop browsers and iOS does not seem to do anything on this event.
Is there any idea on how i can do any one of following:
Completely stop page refresh.
Display warning message to user for not leaving the page (OnBeforeUnload not working on iOS)
Somehow, update Request.Form Collection (Note that it has a Set but it is readonly, so it doesnt work)

Resources