Why do PostBacks Work with JavaScript Disabled

F

Frankie

Just doing some testing here to see what happens when JavaScript is
disabled. I was told somewhere along the line that PostBacks would fail
because they rely on JavaScript:
function __doPostBack(eventTarget, eventArgument) {...

But my page is still posting back just fine with JavaScript disabled (while
other JavaScript-dependent features are totally broken).

So, how do PostBacks still happen?

Thanks!
 
N

Nick Malik [Microsoft]

Just doing some testing here to see what happens when JavaScript is
disabled. I was told somewhere along the line that PostBacks would fail
because they rely on JavaScript:
function __doPostBack(eventTarget, eventArgument) {...

But my page is still posting back just fine with JavaScript disabled
(while other JavaScript-dependent features are totally broken).

So, how do PostBacks still happen?

When a browser sends a request for a page to ASP.Net, the system will
inspect the headers to see if Javascript is allowed.

This happens before the form comes down to the client. Remember that
ASP.Net is writing the code that the browser uses.

If Javascript is allowed, then the code and HTML that is emitted uses
Javascript. If not, ASP.Net will emit different HTML code so that your page
will use traditional form POST.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top