Hi! I want open new tab. I used bellow code in head it’s worked.
<script type="text/javascript">
function opnURL(opt) {
var url = "example.aspx";
if (opt == 0) {
window.location = url;
} else if (opt == 1) {
window.open(url);
} else if (opt == 2) {
window.open(url, '_blank'); self.focus();
}
}
</script>
When I used this code in button click it’s open new window show two browser window in desktop.
protected void Print_Click(object sender, EventArgs e)
{
Response.Write("<script>var url = 'example.aspx'; var opt = 2; if (opt == 0) { window.location = url; } else if (opt == 1) { window.open(url); } else if (opt == 2) { window.open(url, '_blank'); self.focus(); }</script>");
}
How I can open new tab use this code in button click? For example output I want this: