[英]allowing pop ups with a alert
我試圖這樣做,當用戶點擊警報時確定,它將允許我的網站彈出窗口。 我目前的代碼是:
var w = window.open( "urls","_blank", "height = 200, width = 300, top=450, left=1025" );
if(w == null || typeof(win) == "undefined" || win.location.href == 'about:blank') {
alert("You must allow pop ups before continuing, click the button to allow pop ups");
}
如何實現這一目標或者如果不可能,我怎樣才能實現一種方式,以便他們可以輕松地允許我的網站彈出窗口,而不必通過進入瀏覽器設置讓他們允許。
非常感謝
為什么不隨機化錨標記中的href? ES:
<a href="" id="randLink" target="_blank">Open a random site</a>
想象一個jquery函數:當首次加載頁面時,選擇一個隨機站點並將鏈接放在#randLink的href中:
$(document).ready(function() {
$('#randLink').attr('href',generateRandUrl());
});
並在每次點擊時,更改href值:
$( "#randLink" ).click(function() {
$('#randLink').attr('href',generateRandUrl());
});
generateRandUrl()是一個返回您的某個網站的字符串值的函數
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.