Gmail does not obey browser settings for tabs - browser

I noticed that Gmail is not obeying my browser settings for tabs.
For ex:
In Firefox3.6.10, I have unchecked the option "When I open a link in new tab switch to it immediately".
But still when I do CTRL+CLICK on a mail, it opens in a new tab and switches to it.
or
In IE8, I have selected "Always open pop-ups in a new window" but when I do CTRL+CLICK on a mail, it opens in a new tab instead of a new window.
My question is
Is it possible to override user's browser settings?

I was curious about how CTRL-click and SHIFT-click work on these gmail "fake JavaScript links" myself (they appear to ignore browser settings), so I did some testing.
gmail CTRL-click does obey browser "new window/popup" settings (in Firefox the default is "open in new tab", in IE8 the default seems to be "open in new window".) If you change IE8's settings to "Always open popups in a new tab", then you get the same behaviour as Firefox. So gmail CTRL-click is very likely just using "window.open()" in JavaScript, and it's really nothing special. I seriously doubt there's any way to force a new tab to open in JavaScript. Like Yonizaf said, what you observed doesn't seem possible.
gmail SHIFT-click probably uses this method to try to always open a new window (and never a new tab) in JavaScript (window.open() with window dimensions):
JavaScript open in a new window, not tab
As far as the focus thing goes, I noticed that in Firefox new gmail tabs always get the focus, regardless of the "when I open link in new tab, switch to it immediately" setting (like you said), but in IE8 the behaviour seems to be controlled by the "Always switch to new tabs when they are created" setting. I'm guessing this is probably just a result of how Firefox and IE's developers chose to handle new tabs that are created by window.open(), and there isn't much you can do about it, except as Yonizaf said, try to use the window.focus() method (I have a feeling it may not work in IE, though). In fact you can test this for yourself in Firefox and IE8 (disable your pop-up blocker first). I pasted the following URL into both Firefox and IE8 (with "Always switch to new tabs when they are created" disabled, and "Open popups in new tabs" enabled):
javascript:window.open("http://www.google.com", "_blank")
In Firefox, the new tab was opened in the foreground. In IE8, the new tab was opened in the background.
I don't like these JavaScript "fake links" personally, because you lose the middle-click and right-click functionality, and they trigger the pop-up blocker.

the first one is possible, since this options only meant to change the default behavior for links.
the mail list in gmail aren't normal links, it's using javascript.
for the second example, the option can't be overriden by the webpage, but using ctrl+click always means open in new tab, so it's overriden by the user, not the page.

Related

How to keep extension pop up to remain open when new tab is clicked

my extension close when link in the extension is clicked
How to keep extension pop up to remain open when new tab is clicked
In general, that's not possible as stated in Chrome Extensions FAQ:
Can extensions keep popups open after the user clicks away from them?
No, popups automatically close when the user focuses on some portion of the browser outside of the popup. There is no way to keep the popup open after the user has clicked away.
However, if you inspect the popup, it will stay open as long as you don't close the Developer Tools window.
For end users, the only thing you could do is use a tab instead of a popup if that works better for your use case, or just inject your code into a specific tab to show your interface on top of/next to a page, as some extensions like Siteimprove do.

Sharepoint Open Page in New Tab not Window

I am working on a sharepoint page and want certain links to open in a new tab not a new window. I haven't seen any way to do this other than have server access or doing some invasive coding. I'm not sure of actual version of SP but think it's 2007.
IE version is v8
I checked code in edit mode and can see the target blank bit but as I said it opens in new window not tab.
Thanks
Andrew
_blank option for target param instructs the browser to open hyperlink in either new tab or window. But it depends on browser config or how link has been clicked on (middle click, ctrl+click or normal click) how the link would be opened (new window or new tab).

Toggle new tab and popup in options.js

I was curious to see if anyone had any experience with allowing the user to turn off or on the new tab chrome_url_override.
I am currently developing an extension that loads the content when a new tab is opened, but would also like to have the option of turning the new tab functionality off and allowing the user to use the extension as a popup located on the toolbar.
I would prefer not to separate this between two extensions, so if anyone has done or seen anything like this that would be a tremendous amount of help.
Nope! you will need to do it manually, unfortunately. If it helps, the new tab returns www.google.com with location.hostname so your scripts could use this to detect a new tab.
Hope it helps!

Configurable keyboard shortcut without using content scripts

Chrome Extension: I am looking for a way to assign global keyboard shortcuts that can be invoked even when the current tab has no content (and hence no content script). Some examples of such tabs: 'new tab' tabs, chrome://extensions tabs, 'page not loaded' tabs, etc Use cases for such a requirement are operations like close tab, go to next/prev tab, etc.
The chrome.commands api allows one to do this. However, there seems to be no way for the user to configure these keyboard shortcuts, which is something I'd really want my extension to allow.
Is there any way to get configurable keyboard shortcuts that don't need a content script?
The shortcut for chrome.commands cannot be changed by the extension, but it is configurable by the user. This interface is built-in and offered by Chrome itself.
Visit the extensions page, scroll down and click on the Configure commands link. A box will be shown, where the user can set the preferred shortcut:
The code for the "Remap shortcut" extension is posted in this answer.

Any way to remove X button from chrome tabs?

Is there any way to modify chrome tabs to remove the button that closes the tab?
I've read through chrome develope tab. but I don't see any mention of the close button.
Not possible at the moment without forking the whole chromium project. See bug report #50913 (Status: WontFix).
Possible workarounds:
If you right click on a tab you can Pin Tab. This will remove the close button but you can still close it with ctrl+w. Unfortunately, this will also remove the window title.
The close button is removed if the width of the tab gets very small.
Have a look at the same question on SuperUser: How to disable the close (X) button on Google Chrome tabs?.
Maybe you like to look at the source code of Chromium and fix this? I think you have to start here: tab.cc.
Edit: The fix below only worked between Chrome version 69 and 71.
It IS possible now for inactive tabs!
I have had lots of problems while trying to switch tab while having 10-15 of them opened, accidentally closing some important tab with lots of text typed which isn't recovered by Ctrl+Shift+T
Here how to do that:
1) Open the Google Chrome browser and type the following text into the address bar:
chrome://flags/#close-buttons-inactive-tabs
This will open the flags page directly with the relevant setting.
2) Set the option named Close buttons on inactive tabs. Set it to Disabled using the drop down list next to the flag's name.
3) Restart Google Chrome by closing it manually or you can also use the Relaunch button which will appear at the very bottom of the page.
4) The close buttons will disappear from inactive tabs.
Before:
After:
That's it!
Source - https://winaero.com/blog/remove-close-buttons-inactive-tabs-google-chrome/
There are now Chromium-based alternative browsers which offer this - I really like Vivaldi, where not showing the X button is just one of many customization options. Also, because it is Chromium based you can install and use any Chrome extensions. It is perfect if you have many tabs open and need more of the power-user type options.

Resources