开发者

Webpage source code incomplete: hidden code?

开发者 https://www.devze.com 2023-04-04 04:03 出处:网络
I\'m trying to understand how this login page works by looking at the source from my browser (Chrome).

I'm trying to understand how this login page works by looking at the source from my browser (Chrome).

The source links to some CSS, pictures, and generic JavaScript libraries. Apart from a little jQuery at the very start (for changing the language), I don't see why the page isn't more than just dead HTML elements.

For example, if I click "LO开发者_开发技巧GIN" with an empty username and password, the message "The username or password you entered is incorrect." appears. But I can't see anywhere in source where such behaviour is defined.

What am I missing?


The activity you are observing is one of the core functions of <form> elements. When a form is submitted, the user's browser is directed to the page defined by the action attribute in the form. In addition to directing the user to this page, all of the inputs included in the form are passed to the web server as variables.

One way of submitting a form is by including an input element of type submit within the form, which is what the web designer has done here. When that submit element is invoked (via a click, for example), the form is submitted.


The message you see is not shown by jQuery / Javascript.

Notice that when you click the "LOGIN" button, the page submits your request. That means it Server Side code starts to run, code that you cant see.

This Server Side code handles your input and generates the Error Message that you see.


When you click the LOGIN button, the form is submitted to the server,which returns a new HTML containing the message. The logic for that is defined in server-side code, which you can't see from outside. 'View source' will only display what the server outputs.


I think the page is simply refreshing. You can confirm this by opening the network tab in chrome console and watching it as you submit the empty form.

Thanks to http asset caching, this seems as if the page did not refresh - but chrome's network tab confirms it does.

0

精彩评论

暂无评论...
验证码 换一张
取 消