javascript - Chrome 无法识别我的登录表单

标签 javascript html forms google-chrome passwords

代码:

<?php $thisPage="Logga in";?>
<?php include 'phpincludes\header.php';?>
<?php include 'phpincludes\login_process_data.php';?>

<div id=divLogin class=divCentered>
    <form action="<?php echo $_SERVER['PHP_SELF'];?>" method=POST autocomplete=on>
        <fieldset>
            <?php displayAuthStatus(); ?>
            <label class=loginLabels>Användarnamn:</label>
            <br>
            <br>
            <input class=loginInputs name=username></input>
            <br>
            <label class=loginLabels>Lösenord:</label>
            <br>
            <br>
            <input class=loginInputs type=password name=password></input>
            <br>
            <input id=btnLoginSubmit type=submit value="Logga in"></input>
        </fieldset>
    </form>
</div>

<?php include 'phpincludes\footer.php';?>

我已经阅读了其他几个线程,但它对我不起作用(可能重复):

How to make Chrome remember password for an AJAX form?

why doesn't chrome recognize this login form?

Chrome, Safari and Opera do not remember password on simple form

上下文:那么如何让 Chrome 识别我的表单并保存密码?

编辑:添加生成的 html:

<!DOCTYPE html>
<html hc="a0" hcx="0"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="beginner course page">
<meta name="keywords" content="HTML,CSS,JavaScript,PHP,beginner,course">
<meta name="author" content="Petrus K.">
<!-- using jQuery 1.9.1 due to its IE 6+ browser support -->
<!-- read more: http://jquery.com/browser-support/ -->
<!-- using Googles CDN due to faster load times when fetching the jQuery lib -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>Logga in</title>
</head>
<body>


<h1 id="header" class="imagify">Filmsamlingssidan</h1>

<div id="outer_navbar">
    <div id="navbar">
        <ul id="navbarul">
            <li class="navbarli"><a class="navbaritem" href="start.php">Start</a></li>
            <li class="navbarli"><a class="navbaritem" href="filmer_js.php">Filmer (JS)</a></li>
            <li class="navbarli"><a class="navbaritem" href="filmer_php.php">Filmer (PHP)</a></li>
            <li class="navbarli"><a class="navbaritem" href="filmtips.php">Filmtips</a></li>
            <li class="navbarli"><a class="navbaritem" id="currentpage" href="login.php">Logga in</a></li>          <li class="navbarli"><a class="navbaritem" href="kontakt.php">Kontakt</a></li>
        </ul>
    </div>
</div>

<h2 id="subheader" class="imagify">Logga in</h2>
<div id="divLogin" class="divCentered">
    <form action="/mycontent/uppg/uppg4/ver1/login.php" method="POST" autocomplete="on">
        <fieldset>
                        <label class="loginLabels">Användarnamn:</label>
            <br>
            <br>
            <input class="loginInputs" name="username">
            <br>
            <label class="loginLabels">Lösenord:</label>
            <br>
            <br>
            <input class="loginInputs" type="password" name="password">
            <br>
            <input id="btnLoginSubmit" type="submit" value="Logga in">
        </fieldset>
    </form>
</div>

<div id="divFooter">
<p id="text_footer">Sidan är skapad av Petrus K.</p>
</div>


<span id="hc_extension_svg_filters" hidden=""><svg xmlns="http://www.w3.org/2000/svg" version="1.1"><defs><filter id="hc_extension_off"><feComponentTransfer><feFuncR type="table" tableValues="0 1"></feFuncR><feFuncG type="table" tableValues="0 1"></feFuncG><feFuncB type="table" tableValues="0 1"></feFuncB></feComponentTransfer></filter><filter id="hc_extension_highcontrast"><feComponentTransfer><feFuncR type="gamma" exponent="3.0"></feFuncR><feFuncG type="gamma" exponent="3.0"></feFuncG><feFuncB type="gamma" exponent="3.0"></feFuncB></feComponentTransfer></filter><filter id="hc_extension_highcontrast_back"><feComponentTransfer><feFuncR type="gamma" exponent="0.33"></feFuncR><feFuncG type="gamma" exponent="0.33"></feFuncG><feFuncB type="gamma" exponent="0.33"></feFuncB></feComponentTransfer></filter><filter id="hc_extension_grayscale"><feColorMatrix type="matrix" values="0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"></feColorMatrix><feComponentTransfer><feFuncR type="gamma" exponent="3"></feFuncR><feFuncG type="gamma" exponent="3"></feFuncG><feFuncB type="gamma" exponent="3"></feFuncB></feComponentTransfer></filter><filter id="hc_extension_grayscale_back"><feComponentTransfer><feFuncR type="gamma" exponent="0.33"></feFuncR><feFuncG type="gamma" exponent="0.33"></feFuncG><feFuncB type="gamma" exponent="0.33"></feFuncB></feComponentTransfer></filter><filter id="hc_extension_invert"><feComponentTransfer><feFuncR type="gamma" amplitude="-1" exponent="3" offset="1"></feFuncR><feFuncG type="gamma" amplitude="-1" exponent="3" offset="1"></feFuncG><feFuncB type="gamma" amplitude="-1" exponent="3" offset="1"></feFuncB></feComponentTransfer></filter><filter id="hc_extension_invert_back"><feComponentTransfer><feFuncR type="table" tableValues="1 0"></feFuncR><feFuncG type="table" tableValues="1 0"></feFuncG><feFuncB type="table" tableValues="1 0"></feFuncB></feComponentTransfer><feComponentTransfer><feFuncR type="gamma" exponent="1.7"></feFuncR><feFuncG type="gamma" exponent="1.7"></feFuncG><feFuncB type="gamma" exponent="1.7"></feFuncB></feComponentTransfer></filter><filter id="hc_extension_invert_grayscale"><feColorMatrix type="matrix" values="0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"></feColorMatrix><feComponentTransfer><feFuncR type="gamma" amplitude="-1" exponent="3" offset="1"></feFuncR><feFuncG type="gamma" amplitude="-1" exponent="3" offset="1"></feFuncG><feFuncB type="gamma" amplitude="-1" exponent="3" offset="1"></feFuncB></feComponentTransfer></filter><filter id="hc_extension_yellow_on_black"><feComponentTransfer><feFuncR type="gamma" amplitude="-1" exponent="3" offset="1"></feFuncR><feFuncG type="gamma" amplitude="-1" exponent="3" offset="1"></feFuncG><feFuncB type="gamma" amplitude="-1" exponent="3" offset="1"></feFuncB></feComponentTransfer><feColorMatrix type="matrix" values="0.3 0.5 0.2 0 0 0.3 0.5 0.2 0 0 0 0 0 0 0 0 0 0 1 0"></feColorMatrix></filter><filter id="hc_extension_yellow_on_black_back"><feComponentTransfer><feFuncR type="table" tableValues="1 0"></feFuncR><feFuncG type="table" tableValues="1 0"></feFuncG><feFuncB type="table" tableValues="1 0"></feFuncB></feComponentTransfer><feComponentTransfer><feFuncR type="gamma" exponent="0.33"></feFuncR><feFuncG type="gamma" exponent="0.33"></feFuncG><feFuncB type="gamma" exponent="0.33"></feFuncB></feComponentTransfer></filter></defs></svg></span></body></html>

最佳答案

尝试做

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST" autocomplete="on">

我认为方法属性中缺少双引号会把事情搞砸。

完成

<?php $thisPage="Logga in";?>
<?php include 'phpincludes\header.php';?>
<?php include 'phpincludes\login_process_data.php';?>

<div id="divLogin" class="divCentered">
    <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST" autocomplete="on">
        <fieldset>
            <?php displayAuthStatus(); ?>
            <label class="loginLabels">Användarnamn:</label>
            <br>
            <br>
            <input class="loginInputs" name="username"></input>
            <br>
            <label class="loginLabels">Lösenord:</label>
            <br>
            <br>
            <input class="loginInputs" type="password" name="password"></input>
            <br>
            <input id="btnLoginSubmit" type="submit" value="Logga in"></input>
        </fieldset>
    </form>
</div>

<?php include 'phpincludes\footer.php';?>

关于javascript - Chrome 无法识别我的登录表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20315820/

相关文章:

html - 流畅布局中的标题自定义

java - 使用 Javascript 在提交时更改字段的值

javascript - HTML根据用户语言显示不同的div

javascript - 通过 POSTMAN 注册 Azure IoT 中心设备会导致未经授权

javascript - 我可以使用 3ds max 中的模型为 Web 创建 3D 旋转木马吗?示例包括

html - 使用媒体查询实现响应式正文背景

JavaScript:如何从最后到第一个反转 order=[] 数组?

html - 如何访问和显示来自 ionic 应用程序的图像?

php - 如何为 "Price"设置自定义表单输入字段?

javascript - 如何放弃单击按钮时的表单更改?