我有一個頁面,用戶會點擊它來發送邀請他的朋友在Gmail無法重定向使用javascript
這裏的用戶是按鈕
這裏是JavaScript部分
function TwkInvite() {
alert('function is called');
window.location.href = "https://accounts.google.com/o/oauth2/auth?client_id=*********-*************.apps.googleusercontent.com&redirect_uri=https://www.example.com/app/invite-send&scope=https://www.google.com/m8/feeds/&response_type=code";
}
我已經試過window.location.href,window.location的,location.href一切
此功能正在執行完美的警報也執行,但我不知道它爲什麼不重定向到谷歌網站,只要我點擊按鈕頁面刷新
沒有錯誤打印,我檢查了mozilla控制檯但也沒有發現錯誤
的可能的複製[window.location.href處理不工作:()(http://stackoverflow.com/questions/6109527/window-location-href-not-working) – Rahul
'
can y你看看這個http://stackoverflow.com/questions/6109527/window-location-href-not-working我希望它會有所幫助。它建議返回false或在location.href之後使用event.preventDefault()。 – Rahul