Basically I just want to click on the link an a new window should open. But the window does open in a new tab. Not sure why
<a href="http://www.google.com" target="_blank" style="font-size: 12px;" onclick="popupwindow(this.href, 'Redirect to')"><b>Link</b></a>
The JS: Fiddle link
Follow Steps :-
1. In html write return false to avoid default event default behaviour
2. From javascript return false
3. Check for popup blocker
JAVASCRIPT
function popupwindow(url) {
newwindow=window.open(url,'name','height=200,width=150');
if (newwindow == null || typeof(newwindow)=='undefined') {
alert('Please disable your pop-up blocker and click the "Open" link again.');
}
else {
newwindow.focus();
}
return false;
}
HTML
<a href="popupex.html" onclick="return popupwindow(this.href)"
>Link to popup</a>
不幸的是,这无法控制,这完全取决于用户代理。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.