Reputation: 1460
I have a small javascript function which opens an url in a new tab:
function RedirectToPage(status) {
var url = 'ObjectEditor.aspx?Status=' + status;
window.open(url , '_blank');
}
This always works when called client-side by clicking a button, even in chrome. But in Chrome it won't work when it's called from server-side(!) by using
ScriptManager.RegisterClientScriptBlock()
In Firefox and IE it opens the url in a new tab, but chrome opens the url in a new window. What could be a workaround to force Chrome to open it in a new tab?
Upvotes: 24
Views: 202196
Reputation: 49
window.open(skey, "_blank", "toolbar=1, scrollbars=1, resizable=1, width=" + 1015 + ", height=" + 800);
Upvotes: 3
Reputation: 430
As Dennis says, you can't control how the browser chooses to handle target=_blank.
If you're wondering about the inconsistent behavior, probably it's pop-up blocking. Many browsers will forbid new windows from being opened apropos of nothing, but will allow new windows to be spawned as the eventual result of a mouse-click event.
Upvotes: 0
Reputation: 32542
"_blank" is not guaranteed to be a new tab or window. It's implemented differently per-browser.
You can, however, put anything into target. I usually just say "_tab", and every browser I know of just opens it in a new tab.
Be aware that it means it's a named target, so if you try to open 2 URLs, they will use the same tab.
Upvotes: 19
Reputation: 12137
You can't do it because you can't have control on the manner Chrome opens its windows
Upvotes: 0
Reputation: 51634
It's a setting in chrome. You can't control how the browser interprets the target _blank
.
Upvotes: 20