开发者

HTML Password entry, type POST, not displaying in Google Chrome

I have Googled and have found issues with Chrome and HTML stuff but I cannot find anything specific to this issue. The code below for the password entry of a captive portal shows just fine in Firefox and Internet Explorer but nothing at all will appear in Chrome and other browsers like those on Android devices and Apple OSes.

<!-- Userna开发者_运维技巧me: <input name="auth_user" type="text" value="guest">
<input TYPE="hidden" name="auth_user" type="text" value="guest">
<input name="redirurl" type="hidden" value="$PORTAL_REDIRURL$">
Password: <input name="auth_pass" type="password" onkeypress="return handleEnter(this, event)">   <input name="accept" type="submit" value="Continue"><br>
<br>Click the 'Continue' button! Do not hit the 'Enter' key!<br>
<!--   <input name="redirurl" type="hidden" value="$PORTAL_REDIRURL$">
<!--   <input name="accept" type="submit" value="Continue">

However, If I move the hidden 'Username:... line' to the third line from the bottom, it shows up just fine in at least Chrome. I cannot test this on a live system, so just wondering if what is below is a correct fix for my issue...

<input TYPE="hidden" name="auth_user" type="text" value="guest">
<input name="redirurl" type="hidden" value="$PORTAL_REDIRURL$">
Password: <input name="auth_pass" type="password" onkeypress="return handleEnter(this, event)">   <input name="accept" type="submit" value="Continue"><br>
<br>Click the 'Continue' button! Do not hit the 'Enter' key!<br>
<!-- Username: <input name="auth_user" type="text" value="guest">
<!--   <input name="redirurl" type="hidden" value="$PORTAL_REDIRURL$">
<!--   <input name="accept" type="submit" value="Continue">

Thanks in advance!

John


The reason for this is because you didn't close the HTML comment on the 'Username' line. Add --> to the end of that line to fix the problem. HTML comments are delimited by <!-- and -->; they are not like // comments such that they do not stop automatically at the end of a line.

This is the fixed code (notice how Stack Overflow's syntax highlighting doesn't render the code all gray, as a comment, like the original):

<!-- Username: <input name="auth_user" type="text" value="guest">-->
<input TYPE="hidden" name="auth_user" type="text" value="guest">
<input name="redirurl" type="hidden" value="$PORTAL_REDIRURL$">
Password: <input name="auth_pass" type="password" onkeypress="return handleEnter(this, event)">   <input name="accept" type="submit" value="Continue"><br>
<br>Click the 'Continue' button! Do not hit the 'Enter' key!<br>
<!--   <input name="redirurl" type="hidden" value="$PORTAL_REDIRURL$">-->
<!--   <input name="accept" type="submit" value="Continue">-->


you missed end of html comment

html comment starts with <!-- and ends with -->

you missed later one ie.

<!-- Username: <input name="auth_user" type="text" value="guest" -->
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜