Let's say I have this function in a javascript on my web page that loads a url from an textfield with id url:
function loadUrl()
{
var url = document.getElementById('url').value;
window.open(url, 'urlwindow');
}
If I open two tabs in my browser and opens my web page in both tabs, I want both tabs to open the url in the same window, not two separate windows. Is this possible?
In other words, I want to target window opened from another tab.
You can't control the behaviur of the user's browser: just add as target windows "_blank" and hope your user have enough recent web client that opens a new tab and not a new window.
In my experience, this works perfectly (and just like you're trying to do it) with Firefox and IE, but not with Chrome or Safari.
Firefox and IE seem to use domain-specific namespaces for target names, while Chrome and Safari seem to use browser tab-specific namespaces for target names, so in these two browsers, 'urlwindow' as seen from tab A is different from 'urlwindow' as seen from tab B.
I'm trying to find a workaround for this myself, but have not yet been successful. See Chrome/Safari: how to open the same window from different tabs or windows
Related
Isn't it possible to open a new full featured window in Chrome using window.open? I have tried everything using parameters, but it looks like chrome ignores the parameters :-|
It shall show a normal browser window with all the functionality that the user has enabled (status, menu, favourites, toolbar Etc.)
Btw. it is working in Firefox
Here are an example:
window.open('http://www.google.com/', '_blank', 'menubar=yes,toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes,dependent,width=800,height=620,left=0,top=0')
We have an onprem crm 2016. I'm opening an html webresource on a click of a ribbon button. I'm using Xrm.Utility.openWebResource(...). The problem with that is we're using IE11 and all users' browsers are configured to let IE decide how to open pop ups.
Guess what, IE decides to open a new tab! Is there a way to open an html web resource in a new window without changing the users' browser options?
Xrm.Utility.openWebResource() performs different in Chrome compared to IE11. Below options are there, pick it what suits you.
window.open()
Unsupported way to open modal dialog - showModalDialog
Xrm.Internal.openDialog()
Source
Xrm.Utility.openEntityForm() has an option to mention as openInNewWindow = true in parameter windowOptions which is not available for openWebResource()
I've currently have an issue with internet explorer 10 when calling window.open with same window name.
When calling window.open multiple times with the same name then multiple windows are opening instead of the page loading in the same window.
window.open("http://www.example.com","windowname","location=0,menubar=0,height=596,width=792,toolbar=0,scrollbars=1,status=0,resizable=1,left=0,screenX=0,top=0,screenY=0");
After some investigation of the user setting (which is a default setup for the company) there is list of sites in the trusted sites, when the domain www.example.com is added to the list of trusted websites then the page loads in the same window.
I've tried assigning the result of window.open to a variable and then calling window.close() before opening a new popup window but this causes a cross domain error.
var variable1 = window.open("http://www.example.com","windowname","location=0,menubar=0,height=596,width=792,toolbar=0,scrollbars=1,status=0,resizable=1,left=0,screenX=0,top=0,screenY=0");
variable1.close();
Can anyone offer an insight into which user setting causes this to happen? and how I always open the popup page in the same window?
I am building a site which when you click a link it opens up two things; it opens up a pop-up and an external website in a new tab. This is so the user can interact with the pop-up whilst he/she browses the external webpage.
This was working fine for me but I think when my FF updated to version 15.0.1 on OSX lion, I can no longer get this to behave the way I want it to.
I have even changed the settings in FF: FF->Preferences->Tabs->Open new window in Tab instead to off and with no such luck.
I have also noticed that facebook connect on any site will open a new tab rather than a new pop-up too.
I can't seem to find any documentation on the web stating that this is FF's native behavior, even in their changelog.
Here is my javascript trigger which I am certain all the parameters are correct:
popWin = window.open('http://somesite.com','myTargetWindowName','height=650,width=450,pageXOffset=900,pageYOffset=900,scrollbars=yes');
I have this code which opens all links in my page in a new window:
<base target='_new' />
It works fine in Chrome but in IE(8) and Firefox not so. In Firefox it does open a new tab, but on a second link click it loads in the new tab but without putting this tab up front, so a user would have to click on the new tab manualy. In IE it opens a new browser window. Is there an equivalent code (..js/Jquery) to open in a new tab in all browsers?
there's no guarantee where the browser will open that new window/tab. different browsers open new windows/tabs differently, and that behavior can also be affected by browser settings.
Firefox has an option to switch to the tab immediately.
Tools -> Options -> Tabs,
"When I open a link in a new tab, switch to it immediately"
IE9 has the same option
Tools -> Internet Options -> General -> Tabs Settings
"Always switch to new tabs when they are created"
IE9 has the option of what to do with new popups.
Tools -> Internet Options -> General -> Tabs Settings
"When a popup is encountered"
- Let Internet Explorer decide ...
- Always open popups in a new tab
- Always open popups in a new window
From http://windows.microsoft.com/en-US/windows7/Tabbed-browsing-frequently-asked-questions
If you opt to let Internet Explorer decide how to display pop-ups, it
will display the pop-up in a new window if the pop-up specifies size
or display requirements. Otherwise, the pop-up is displayed in a new tab.
So the behavior is mostly left up to the user and not the developer.
You can not control this part (how to open - in tab or in window). Since this is decided by browser. More of that, you can not even rely on type of browser, since each user may select his or hers way to open new pages: always in tabs or always in new windows or some other way.
I'm not sure this applies with the "base" tag, but on links, the "target" attribute can either have one predefined keyword, or any name you want to give the new window.
The available keywords are:
_blank: opens the links in a new window or tab
_self: opens the links in the same frame as it was clicked (this is default)
_parent: opens the links in the parent frame
_top: opens the links in the full body of the window
(http://www.w3schools.com/tags/att_a_target.asp)
If you don't use one of those keywords, you can use any name you want and this name will then be used to refer to that window. This allows you to reuse a tab you opened to load a different document in it.
So by using "_new" (which is not a keyword) as the base target, you essentially say that all links must be opened in the window named "_new". At first this window does not exist, so the browser creates it (first click), and the it reuses it for all following clicks.
Use "_blank" instead so that each link opens in its own new tab.