我正在使用网页或用户脚本(这与 chrome 扩展无关),并且根据我的要求,我想打开隐身模式。
这是我的 JavaScript 代码:
$('#google_alert').on('click', function(e)
{
swal({
title: "Review Us",
text: "You will be redirected to review us on google",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#09a275",
confirmButtonText: "Positive",
cancelButtonText: "Negative",
closeOnConfirm: false,
closeOnCancel: true
}, function(isConfirm)
{
if(isConfirm)
{
chrome.windows.create({"url": "http://www.google.com", "incognito": true});
swal("Thank you", "Thank you reviewing us.", "success");
}
else
{
$("#review-modal").modal('show');
}
});
return false;
});
响应:ReferenceError:chrome 未定义
这是我在做什么的程序,
- 点击网页上的谷歌评论选项,
- 它将用户重定向到谷歌评论页面,
- 谷歌要求登录,
- 用户输入凭据并提供评论,
- 返回网页。
在这里您可以看到无需将用户的 ID 和密码保存到浏览器中。