有没有办法告诉浏览器已经显示了一个登录表单,并且它应该用保存的凭据填写该字段?
我有这个SPA,在加载文档后用ajax加载登录视图.我成功登录后设法让Firefox保存凭据但是当我再次尝试登录时,字段未填写.
此外,我似乎无法让Chrome提示保存密码,因为我无法重定向浏览器,Chrome似乎绑定到该事件.
所以我在一个域上有这个页面,脚本标记指向另一个域,每次刷新页面时,都会生成一个新的session_id.这只发生在IE上,所有其他浏览器似乎都有效.
这是一个带代码的例子(JS和PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="http://domain2.com/index.php"></script>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
在http://domain2.com/index.php上:
<?php
session_start();
header("content-type: application/x-javascript");
echo "alert('".session_id()."');";
?>
Run Code Online (Sandbox Code Playgroud)
在domain1.com/index.php中打开Chrome或Firefox,您会看到一个包含会话ID的提醒框.每次刷新时,您始终拥有相同的会话ID.在IE中(我试过7,8和9),会话ID总是不同的.cookie似乎没有正确保存.
谢谢你的帮助.