javascript. Can't open new tab in safari - tabs

The following javascript opens a new tab fine in Firefox, chrome, and IE. but it opens a new window in safari.
javascript:window.open(url,'_blank'); // opens new window in safari.
I need to open a new tab NOT a new window in safari. anyone else seeing this behavior? fixes? I can't seem to find any recent posts that address this... maybe it's just me.
-Thanks.
Using safari 5.1.7 on windows.

Modify your browser preference; Edit/Settings (gear icon) -> Preferences -> Tabs and select the Automatically or Always option in the drop-down menu of "Open pages in tabs instead of windows".

It turns out it's a browser preference, which can be edited under Edit -> Preferences -> Tabs and select the Automatically option in the drop-down menu Open pages in tabs instead of windows.

Safari does not support window.open. Please visit this link -
https://developer.apple.com/library/archive/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html

let winOpen = window.open('', "_blank")
winOpen.location = 'https://example.com'
Maybe you can try these code .

This worked for me in Mac/Safari:
var windowReference = window.open();
myService.getUrl().then(function(url) {
windowReference.location = url;
});
I found this here : window.open(url, '_blank'); not working on iMac/Safari

Related

How to Automatically redirect website IE browser to Chrome browser?

Recently we migrated to latest version of application which allows the user to open application in any browser.
Earlier it use to support Only IE browsers.
After migration many users still open the application in old browser.
Since the application is very slow in IE browser.We are looking for a solution that will automatically open the URL/Login Page in Chrome browser when user opens in IE browser.
i.e., when a user open URL in IE browser it automatically open the same URL in Google chrome browser.
Google Chrome Legacy Browser support allows this. Under the "Hosts to open in Alternative Browser" policy, put in an entry for the site you want to force to open in Chrome, preceding it with an "!". Example:
!https://www.somesitetoopeninChromeonly.com.
If i understand it correctly, the users open a page in IE and when they click an url on that page, it will open that URL in Chrome.
I guess, you can't do this. You can use target="_blank" to open a new tab in the same browser.
If you want to open a link from an application in chrome and not in IE, you can change the default browser to chrome. Click on Start, type the "default app settings" and change the default browser to chrome.
I think the best solution is to let the user open Google Chrome manually by informing about it.
It is possible however, to make a document called "chrome.hta" for example, with the contents shown below, and then link to it on another page. (This will only work in Internet Explorer, not Edge)
<script type="text/javascript" language="javascript">
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe";
var website = "http://example.com/";
oShell.ShellExecute(commandtoRun, website, "", "open", "1");
window.close();
</script>
The user now has to press "open" and "allow" after they click the link referring to the .hta file.
Now, on the page where you link to the .hta document, you can make the page detect the browser and adjust the link accordingly:
<a id="link" href="example.com">My Application</a>
<script>
if (navigator.appName == 'Microsoft Internet Explorer' || !!(navigator.userAgent.match(/Trident/) || navigator.userAgent.match(/rv:11/)) || (typeof $.browser !== "undefined" && $.browser.msie == 1))
document.getElementById("link").href = "example.com/chrome.hta";
</script>
A bit late, but we have two different solutions for this:
We use a javascript: link to use ShellExecute to run a small exe helper application that checks if Chrome is installed, and if it is, open Chrome to the URL parameter, optionally with switches (e.g. --use-system-default-printer and on shared logon PCs, --incognito). This requires configuring special permissions for the site in Internet Options|Security.
Now we can also use the microsoft-edge: protocol to open sites in Edge.
You could also install your own protocol for opening sites in Chrome but you would need a helper application to re-write the URL. I have one written to add microsoft-edge-private: to open links in Edge in InPrivate mode.
To open the webpage in Microsoft Edge you can try the below code.
TEST

Open Page As New Tab In Google Chrome

We are not able to open a page as new tab in Google chrome. We are able to successfully open page as new tab in Internet Explorer, Mozilla and Safari.
Just for your information we have added "_blank" in "window.open" which have successfully opened page as new tab in all 3 browsers (Internet Explorer, Mozilla and Safari) except in Google Chrome.
Can any one please let us know what changes we should do to open a page as new tab in Google Chrome?
Regards
Tarunjit Singh
If you did it with javascript, this script may be useful:
function RedirectToPage(status) {
var url = 'ObjectEditor.aspx?Status=' + status;
window.open(url , '_blank');
}

IE9 open link in a new window/tab not working

Today I just noticed that Internet Explorer 9 will not open a new window/tab when clicking a link whose target is set as _blank. It will open the link on same tab itself.
Link should open in new tab
This feature is working on all other versions of IE
I tried this solution by microsoft but not working at all.
Did anyone have a working solution for this bug??
Let's type http:// before www.mydomain.com.
In IE9 you can only change TAB settings, there seems to be no place to change window behaviour.
I am also finding that when I try and open pages (any website) in a new window, ie opens it in the same window.
Its not about certain webpages. Something is definetely wrong with IE software. Even when you right click on a link and choose option stating "Open link in a new TAB" it still opens it in new window instead of a tab. This cant be issue with settings as those affect single left click mouse behavior and not a choice where you tell IE to open particular link in TAB! My IE settings although are set to open links in new tabs and same as when pop up is encountered its set to open in new tab. So sofware has issues. Please fix it

target="_blank" opens a new window in IE9, instead of a new tab

In my link, I have target="_blank" attribute, and it works in Chrome, Firefox, Opera, and of course, Safari and opens the link a new TAB. But When I click on it, in IE9 (and IE8) it opens a new window instead of being opened in a new tab. What should I do?
HTML and JavaScript provide no means to say if a new "window" should be a full window, or a tab, or whatever you want to call the Mobile Safari multiple views interface.
So you live with it.
You can see in this question that the target="_blank" is correct, but the way the browser handles this case is up to his settings.
You need to change IE8/9 settings to open that kind of target in a new tab. There's nothing you can do :|
This is configured browser side and theres nothing you can do about it in your html I'm afraid. Its just an option that a user sets in their browsers preferences.
You need to use the target="_blank" attribute to make links open in a new window or tab. Where the link actually opens is up to the browser settings. So if you have Tools > Internet Options > Tabbed Browsing Settings > "Always open pop-ups in new tabs" selected, a target="_blank" link will open in a new tab. Note that this type of link will open in a new window by default on most browsers.
Unchecking Protected Mode in IE9 resolved my problem.
Windows Internet Explorer 8 and later. When Protected Mode is enabled and a webpage contains an anchor link with a named target, Windows Internet Explorer opens the target of the link in a new window when the target has a different integrity level than the webpage containing the link.
Source: target attribute in IE

How to open html link in a new window instead of a new tab on Firefox and Chrome?

My links correctly open a new window when using IE8; but when I use Firefox or Chrome, they just open a new tab.
I am using the code target="_blank" for my links.
How do I fix this so it opens a new browser window and not just another tab?
This fix needs to be for everyone that views the page and not just for my personal use.
It is there with the browser, because they supports tabbing, it will open in a tab. Having said that, there are probably some settings for them in each browser as well as addons that control that, for example, in firefox, you can control window positioning, tabs and a lot more with Tab Mix Plus addon.
Note that you can also open in new window with window.open eg:
window.open('example.html', 'name', 'settings')