透過 javascript 但不使用 window.open 來開啟網址
目的是為了避免被瀏覽器阻擋
function openURL(url, target) {
var link = document.createElement("a");
link.href = url;
link.target = target;
document.body.appendChild(link);
link.onclick = function () {
requestAnimationFrame(function () {
document.body.removeChild(link);
delete link;
})
};
link.click();
}
openURL('http://www.google.com', '_new');
function openURL(url, target) {
var link = document.createElement("a");
link.href = url;
link.target = target;
document.body.appendChild(link);
link.onclick = function () {
requestAnimationFrame(function () {
document.body.removeChild(link);
delete link;
})
};
link.click();
}
openURL('http://www.google.com', '_new');
留言