Thought about it some times, and I decided to ask:
Why do a browser don't block the screen when doing a postback?
I have always been bothered by the fact that web browsers usually (can't say I've used them all) doesn't block the screen after I click a button that produces a postback. As I see it, during post a browser is expecting the server to send some information back. If it doesn't, the connection will time out and the page will be replaced by an error. If the server answer, it has to be with a web开发者_开发百科 page; In other words, there's no possibility to keep the current web page rendered.
But it happens rather often that I click a button, realize that I forget to check a checkbox and so I click it, but to no avail. I know, I should have realized that clicking the checkbox wouldn't help, but hey, I usually doing stuff in auto-mode.
I think that it could be that the browser blocked the web page after you pushed a button or clicked a link that will produce a post back, so you couldn't press anything. But for some reason most browsers don't. Why?
The browser only shows what the page says and does what the script tells it to. If the page designer didn't implement anything to disable input during the connection, the brower leaves it up. In some cases this can be useful, such as when the input devices need to be available (although I can't think of a good example off the top of my head). A quick way to disable them (aside from disabling each individual input) is to have a hidden div with a z-index higher than the rest of the page become unhidden with a low opacity (screen looks slightly tinted, div prevents anything underneath it from being used) and then hiding it again when a response is received. Ultimately it's just the result of a design choice. Does that answer your question?
When a browser blocks input is generally intentionally programmed that way. Postback and clicking a button is not coupled because a button is not always used to do a postback.
Even when the browser is doing a request to some server in background, this request is not always fired by a button pressed (see Ajax)
In other words, there are much more complex scenarios than "push button, then postback", in order to cover every scenario, browser let this control to the programmer.
精彩评论