I want to open a link in new tab using java script.if browser setting are to open in new link in new window then that window size should be set to default height and width.how to achieve this one.
Thanks in advance..
I want to open a link in new tab using java script.if browser setting are to open in new link in new window then that window size should be set to default height and width.how to achieve this one.
Thanks in advance..
Try this,
function openNewWindow(url,popName){
var popupWindow = window.open(url,popName,'scrollbars=1,height=650,width=1050');
if($.browser.msie){
popupWindow.blur();
window.focus();
}else{
blurPopunder_bg();
}
};
function blurPopunder_bg() {
var winBlankPopup = window.open("about:blank");
if (winBlankPopup) {
winBlankPopup.focus();
winBlankPopup.close()
}
};
Hope it's work for you
This is not javascript I believe, in the a href tag you just need to give _blank.
As in this example
<a href="http://www.w3schools.com/" target="_blank">Visit W3Schools!</a>
Open a URL in a new tab (and not a new window) using JavaScript
Also, most web browsers give you an option to open in new tab. But this question has been answered before.
If you are making a complete website, and many links will do this, i'd suggest using CSS to set the height and width.