従業員がセキュリティバッジをスワイプできるようにする Web アプリケーションの単純なログイン機能に取り組んでいます。カードから入力をキャプチャして正常にログインできますが、ダウンロードペインがすぐに開くという奇妙な問題が発生していますGoogle やさまざまなフォーラムで解決策を検索しましたが、見つかりませんでした。:/
磁気カード リーダーは Chaptek MR300 です。アプリケーションは PHP と AJAX を使用します (処理用)。
これは私が今持っているコードで、おそらく JavaScript を使用してダウンロード ペインが開かないようにする方法を見つけようとしていました。
<?php><html><script>
function loginWithSecurityBadge() {
var x = document.getElementById("badge_input");
var y=x.value;
if (y.substring(y.length-1) == '\n') { //Ignore the newlines
return;
}
if (y.substring(y.length-1) == "?") { //Stop and sumbit when last character is received identifying end of card code
x.stopPropagation();
x.action = "/path/to/somescript.ext.php";
x.submit();
return;
}
}
</script>
</html><?>
ダウンロード ペインが突然開く現象は、Firefox、Chrome、Chromium、Safari、Opera、および Internet Explorer で発生します。この煩わしさがなければ、これは素晴らしく機能的なログイン スクリプトです。ダウンロードの開始を停止する方法についてのアイデアはありますか?
ここに私が得るヘッダーがあります:
Date: Tue, 11 Jun 2013 14:35:49 GMT
Server: Apache Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate,post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Encoding: gzip
Strict-Transport-Security: max-age=63072000
x-frame-options: DENY
X-XSS-Protection: 1; mode=block
Content-Length: 4632
Keep-Alive: timeout=10, max=28
Connection: Keep-Alive
Content-Type: text/html
200 OK