Che*_*hev 4 html javascript jquery webkit google-chrome
这个问题是针对同事的.他在Chrome中遇到了一个问题,其中包含以下代码段:
function showEmailClient(emailContent, url, providerContactId) {
window.location = emailContent;
if (providerContactId != undefined) {
setTimeout(function() {
clientSideRedirect(url + providerContactId);
}, 5000);
}
else {
setTimeout(function() {
clientSideRedirect(url);
}, 5000);
}
}?
Run Code Online (Sandbox Code Playgroud)
这些setTimeout功能会立即在Chrome中调用,而不是等待他们应该的五秒钟.有任何想法吗?
更新
emailContent 是mailto字符串,例如'mailto:support@somewhere.com',它会导致用户的默认邮件客户端打开,而不是要重定向的页面.
window.location = emailContent;
Run Code Online (Sandbox Code Playgroud)
一旦命中此行,这将重定向浏览器.