所以我有一個圖像,蘋果音樂徽章。一旦用戶點擊徽章,我想要一個彈出窗口詢問用戶是否想要顯示歌曲的清晰版本或清潔版本,並且相應的按鈕可以執行該操作。Javascript彈出重定向
目前我有一個JavaScript彈出窗口,它應該允許用戶按「確定」重定向到顯式版本,然後按「取消」重定向到清潔版本。這個選項對我來說工作正常,但是按鈕並沒有做我期望他們做的事,兩個按鈕都重定向到了顯式版本。
這是我的HTML和JavaScript至今..
<a class="AppleMusic"
href="**explicit-link**"
style="display:inline-block;
overflow:hidden;
background:url(https://linkmaker.itunes.apple.com/assets/shared/badges/en-us/music-lrg.svg) no-repeat;
width:150px;
height:55px;
background-size:contain;">
</a>
<script type='text/javascript'>
$(window).on('load', function() {
$(".AppleMusic").on("click", function (event) {
if (confirm("This will redirect to the explict version of the song. Press 'Cancel' If you'd like to be redirected to the Clean version.")) {
return true;
}
else {
window.location = "**clean-link**";
}
});
});
</script>
的問題是,無論他們點擊什麼,它重定向到顯性(geo.itunes.apple.com)網址。
我想不使用UI對話框,如果可能的話。
didntn讓你的要求嗎?請更具體 –