예, 가능합니다. 적절한 핸들러를 loadstop 이벤트에 연결 한 다음 전송이 이루어지면 로컬 저장 장치를 사용하여 사용자 이름과 비밀번호를 저장하고 이미있는 경우 자동 입력하십시오.
function loadStopped() {
// Here use JavaScript to manipulate the actual page on hand.
// Can't really give better description about what to do, but something like this:
var username = "";
if (localStorage.getItem("username") !== null) {
username = localStorage.getItem("username");
}
var password = "";
if (localStorage.getItem("password") !== null) {
password = localStorage.getItem("password");
}
document.getElementById("username_field").value = username;
document.getElementById("password_field").value = password;
// document.getElementById("the_form").submit();
document.getElementById("the_form").addEventListener("submit", function() {
localStorage.setItem("username", document.getElementById("username_field").value);
localStorage.setItem("password", document.getElementById("password_field").value);
});
}
ref = window.open('http://google.com', '_self', 'location=yes');
ref.addEventListener('loadstop', loadStopped);
감사합니다. 그러나 나는 정확하게 이해합니까? Phonegap의 index.html에 스크립트를 입력 한 다음 로그인 페이지로 리디렉션되고 자동으로 로그인됩니까? – Bianca
InAppBrowser를 사용한다고 말하면 _window.open_을 사용한다는 의미입니다. 맞습니까? InAppBrowser에서 페이지를 여는 곳에서 스크립트를 사용해야합니다. –
사용 내 index.html의 phonegap에 있습니다. 내 질문에 대해 유감 : 스크립트를 입력해야하는 곳은 무엇입니까? index.html 또는 외부 페이지 test.de/login? – Bianca