Why firefox open a new window for downloading jnlp file - javascript

I have a javascript application that runs in firefox. At some point, I have to start a java application, so I created a jnlp file for it. I have a button that execute some javascript code and then call
window.open('GetJnlpApplication','_blank');
On Chrome, IE, Edge and even Firefox on Linux, this work as excepted: the browser download the jnlp file and run javaws while user remain in the application shown in browser window.
On firefox on Windows (all versions I tried: from 45 onward) a new tab is opened, then javaws is correctly run, but the browser remain on the new blank tab. Please note that IE (and FF on Linux) quickly open a new tab, download jnlp file and close the new tab.
Question is: how do I make firefox immediately close that tab?
Final note: I use target _blank because otherwise firefox would trigger and WindowClosing event when calling window.open(), and this would logout my application.
Post scriptum: I tried without the _blank argument and nothing changed: firefox still open a new tab and keep it opened.

Related

Is it possible to close IE in Kiosk Mode without a comfirmation alert?

I can open a Chrome browser window in kiosk mode from the command line...
start chrome --kiosk "http://example.com/"
...and then close the page with a <button> that simply runs window.close(); in a JavaScript event.
But when I start IE in kiosk mode...
start iexplore -k "http://example.com"
...and click the same button, I get the alert:
The webpage you are viewing is trying to close the window. Do you want to close this window? [Yes /No]
Is there some way -- maybe with JavaScript or IE command line options -- to avoid the alert and get IE to act the same as Chrome?
Have your javascript function do this:
window.open('','_self').close()
Explanation:
IE won't let you close, without warning, a window you didn't open. This function opens a blank window that overwrites the current window. And since you now own it, the next part of the function closes it without issue.

Control the tab in which an externally called URL is opened

I've got a program (not a web application, but an executable) that spews URLs, the URLs are handled by Internet Explorer by default.
The problem: Each URL is opened in a new tab whereas it should be the same tab.
If it's relevant: I'm trying to match an interface of an old (web)application to a new one. The URL is redirected on the server. In the old situation, the URL would open a webpage, start an Active-X control and then close the browser. I'm not in such position now, I cannot use that technique because the new application is a full fledged zero footprint webapp.
Remember that I can't control the browser. It's not opened by me so I cannot do fancy stuff in Javascript for instance.
How to handle this? The best thing I can come up with is changing settings in Internet Explorer, so that it'll always throw away what is in the current tab and replace it with the new URL. Is this possible at all?
I'm not even interested in the tabs as such, if I can always open URLs in an running browser in for instance the first tab I'll be a happy camper.
Thank heaven for co-workers.
In Internet Explorer do Alt+T, O to start the internet options dialog.
In the dialog click the button 'Tabs' and the dialog 'Tabbed browser settings' appears.
Here in 'Open links from External programs in:' select the option 'The current tab or window'.
It does have a drawback that whatever browser or tab is active loses it's content when an external program fires a URL, but that's less offensive than opening browser tab after browser tab...

Chrome Extension: Open window when running in background

So, I have my chrome extension, runs in background fine. And every few hours it uses the notification API to ask the user a question.
If they click one answer we open a tab in the current window.
Problem: If there are no chrome windows open (i.e. the extension is running as part of "Let google chrome run in the background" option), the tab doesn't open.
Here's the code which works fine as long as there is at least a single chrome window open:
// tried this too: chrome.windows.create();
chrome.tabs.create({url: pathToGo});
How to make "chrome.windows.create()" actually make a window if there are none already open.
Use chrome.windows.getAll(object getInfo, function callback) APIs to get all open windows.
If in the callback, the array of windows is empty, create a new window using chrome.windows.create(object createData, function callback).
Use chrome.notifications API if you are unable to create new window.
http://developer.chrome.com/extensions/notifications.html

resizeTo() not working in Firefox

Running Firefox 12.0. I'm just starting to write a app that I want to run on localhost. I want it to open it in a (600,400) window, but since I have Firefox set to open everything in tabs I thought I could bookmark it and right-click to open it in a new window.
$(document).ready(function() {
window.resizeTo(600,400);
});
Doesn't work. Is what I am trying to do possible?
Thanks, Jim
This isn't possible, unless the window was opened through javascript using window.open and has only 1 tab in it.
Since Firefox 7, it's no longer possible for a web site to change the default size of a window in a browser, according to the following rules:
- You can't resize a window or tab that wasn’t created by window.open.
- You can't resize a window or tab when it’s in a window with more than one tab.
MDN docs

Open links in new tab in Firefox

I am developing an Firefox extension. How can all the links on a webpage to be opened in a new tab?
That's usually a configurable option in Firefox to handle new links, so they may override your extension with that.
However...
The code
Example Website
will allow you to click the appearing words [Example Website], and the link will open in the current window.
The code
Example Website
Opens the link in a new window/tab.
The only mildly dodgy thing is that target is now apparently deprecated by the W3C, which means that it's generally up to the browser ( and the user's preferences) as to how (or even if) it is handled. But for people who have their preferences set accordingly - in Firefox - that should work.
I found what I was after. I wanted gbrowser.addtab(this.href).
Press Ctrl while clicking on the link on Windows. Use cmd on OSX.

Categories

Resources