We have an application running in Tomcat 7
We are trying to open a window from our application using javascript, each time an event is called using window.open('url', 'name', '');
But what happens is that each time an event is called a new window is opened and the information is loaded, but it should open one window initially for the first event and for the following events it should reload the information in the same window.
We were able to avoid that situation, what we did was
We used to call our application which is deployed in a different server with the url as follows (http://servername.domain.com:8080/applicaationname), where the above issue happens
But when we call it as http://servername:8080/applicaationname, it works fine as expected
what is causing this behavior?
Many Thanks,
cheers.
In the Internet Zone (which is where your code runs when you use a fully-qualified-domain-name like servername.domain.com) your code has restricted permissions. In the Intranet Zone (which is where your code runs when you use a dotless hostname like servername) there are fewer restrictions on permissions.
The problem you're encountering is that in the Internet Zone, a named window launched from site "A" may not be navigated by JavaScript from site "B"-- instead a new window is created. We introduced this change in IE8 for security reasons, and it matches other browsers and what HTML5 demands.
See http://msdn.microsoft.com/en-us/library/dd565638(v=vs.85).aspx for more information.
Related
Is there a reliable way to know if an other instance of the same page is already opened in the browser?
I’ve tried setting up a variable in local storage at load and unload but mobile browsers do not always send the unload event..
The context of JavaScript code is per opened page (called window). Therefore, there is no reliable way to track open pages unless you open a WebSocket connection to the server and check the number of open pages by associating a unique identifier to each of them and prevent opening multiple pages. If you want to take this approach, search for a WebSocket implementation of your server-side application.
I'm still struggling with the issue I described here: I need to send the user a document and the only tool available to me is requesting a URL to be opened in the default browser.
That works fine but if I link to the document directly, the browser (IE, FF, Chrome, Opera and Safari tested) creates a new, empty tab behind.
I would like to find a way to avoid that.
An additional issue is that users can use a very similar functionality to bypass the login screen and go directly to a specific page of the web app. Unfortunately, since all I have to work with is a URL, every time they invoke that function they end up opening a new tab.
So, I thought that one to solve both issue would be to be able to specify the target of the URL (as if the used clicked on a <a target="mywebapp"> link). Is that possible either through the URL itself or through the web page targeted?
I got two browser windows on the same domain,
one is the main window and the second is small popup window.
i found this: How to Communicate between two browser windows?
but, the problem is the popup opens as event on the local computer by 3rd party software...
and i don't wish to communicate back to the server, and reading the status at the main window, for slow time issues..
i wish to transfer some data from the popup directly to the main window via JS (and close the popup right after).
the event is a VOIP new income call opened by the local phone soft dialer with parameters, and the main window is a browser CRM that will need to show incoming call status via JS on the same page, AJAX-like [only local].
p.s:
maybe there is a way to communicate between browser to windows application?, so the 3rd party software will send data to it and the application will communicate to the window
(or Firefox extension - but i prefer without the need to install more addons)...
what approach should i take? what do you think is the solution?
thanks allot. ;)
If the one browser does not open up the other browser, there is no way for the two browsers to talk through window.opener.
What you could try is storing data into localstorage and have the windows poll localstorage for changes.
Have you tried using window.opener to refer to the parent window?
I've created a JavaScript Windows Store blank app, and added the following code to launch Google in a default browser.
var url = new Windows.Foundation.Uri("http://www.google.com")
Windows.System.Launcher.launchUriAsync(url);
What can I do to specify a specific browser to launch Google in? Is it possible? I think I read somewhere that I can't do this, but I can't seem to find that forum any longer.
You can't do it. Your app doesn't know anything about which browsers are installed, so it won't be able to target a specific one, even if the framework allowed for this (which it doesn't). The other thing to bear in mind is that your user should be in control (in this case by specifying their default browser). You should not try to override this choice.
Is there a way to set a browser session cookie in Javascript, so that only that browser instance can see that cookie. For example, if I set a cookie via Javascript in one instance of Firefox, and then invoke a second instance of Firefox (Ctrl-N or launching firefox.exe again), I do not want that second instance to be able see this cookie.
How would I go about this? Thank you.
You can't. Different browser windows are just different windows to the same instance. Launching Firefox again just spots the running instance and opens a new window in it.
(There are some command line options which might open a new instance (in particular the one to load a different user profile), but that is entirely a client issue and any JS is by the by).