I'm developing a tool that lets you open multiple pages at once with a shortcut, to be used for things like opening your daily sites or querying multiple search engines for a phrase. In Firefox, Internet Explorer and Opera, assuming you've unblocked pop-ups for the domain, the code works as expected.
Chrome, however, opens the sites in new windows instead of tabs if the links are opened automatically when the page loads. If openAll() is commented out and the button is clicked or a key is pressed, the pages open in tabs. Note it's calling the exact same function.
The best solution I've found (which isn't saying much) is the One Window extension. It works, but you can see the new window open then get sucked back in, and it keeps you from opening new Windows with Ctrl-N, forcing you to drag tabs out to use another Chrome window.
I can understand there not being a programmatic way to change this because it's a browser setting, but as a user of the tool it's annoying to have the sites all open in new windows. Is there a Chrome setting or extension that will open links in tabs when they're loaded without user input? I realize opening a bevy of windows is the very thing browsers aim to stop, but this is one time where I want to allow it.
<input id="openAllBtn" type="button" value="Open all links"> (Or press any key)
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
function openAll() {
window.open('http://yahoo.com/');
window.location.replace('http://www.bing.com/');
return false;
}
$(document).ready(function() {
$(document).bind('keypress', openAll);
$("#openAllBtn").bind("click", openAll);
openAll();
});
</script>
Here's a Fiddle of the code: http://jsfiddle.net/sfzjR/
Is there a Chrome setting or extension
that will open links in tabs when
they're loaded without user input?
Check out the create method in the chrome extension docs. By default it will open a new tab, you can optionally specify the window you want that tab to open in, and give the tab a url.
Related
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...
I want to use JS to open a new tab in Firefox but in the page group. That will be Google, in the example. I want the original tab to stay focused and open Facebook. Would also work in as many other browsers as possible, ideally.
I am using this code, and it works, in a way.
The first click will open the new tab and focus on that, which is not what I need.
But, if I make the first tab, the original, go back then press it again, I get the desired behaviour. The new tab will open in the background but the original one will be the one that's focused and changes to the webpage.
<button type="button" onclick="open_in_bg('http://facebook.com', 'http://google.com')" >Press Me</button>
<script type="text/javascript">
function open_in_bg(c_url, n_url)
{
window.open (n_url, "mywindow" );
window.open (c_url+"#maintain_focus","_self");
}
</script>
My first thought is that it may be possible to replicate the result from the 2nd click for the 1st. Possible? Any viable solution?
Sorry to say, I do not believe this is possible. Most browsers have removed any support for controlling tabs via javascript as a security issue. This was removed to prevent pop-unders by nefarious sites.
Here is an info about the user settings
I created a simple firefox add on using addon-builder that installs & successfully appears in the add on toolbar at the bottom of the browser.
If I press ctrl-n, open new tab, open new window, or open private browsing window in firefox, then I see and can use my addon. However, if another site programmatically opens a window using window.open(), then my addon doesn't appear.
Is this by design? Or is there a setting that I can include in my addon so that it always appears, even if the window was opened through window.open() instead of ctrl-n?
When sites open with window.open, they specify which parts of the browser UI will show. You may be able to place it somewhere less likely to be removed, like the navigation toolbar. The add-ons toolbar sounds like it's going away soon, anyway.
Problem
I'm using a web-based feed reader, TinyTinyRSS. When sifting through the feed lists, I'd like to open interesting articles in new tabs - but in the background, because I want to read them only after I went through all feed items.
TT-RSS has a shortcut key "o" to open the article in a new tab, but it opens the tab in the foreground (window.open).
The question is now: To fix TT-RSS, I need to know how to open a background tab from javascript. It'd be awesome if the solution worked across browsers (Firefox, Chrome, Opera, Safari).
I understand the privacy issue about that, but having it enabled for one certified webpage is ok.
Existing (bad) solutions
Firefox
In about:config, set browser.tabs.loadDivertedInBackground to true.
This opens all the tabs from pages in the background, which is not what I want - I want it only for the one application/website.
Chrome
Chrome has a shytab extension. Works in chrome only and is for all pages.
Back when popup ads were a thing, this was called a "popunder" window. Popunders used to do something like this:
var popupWindow = window.open(...);
popupWindow.blur();
window.focus();
Popup blocking kind of messed around with what does and doesn't work, though- your mileage may vary.
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.