I'm sure you've been to those websites which pop up an annoying message when you attempt to close the tab. I am looking for a way to make that little X button actually work the way it should, for all sites, at all times. If I click close tab, I want it to always close the tab, 100% of the time, no exceptions. Is there a way to do this simple thing on firefox or crome?
I'm sure there is a way to make it work like you want it to in Firefox, using an extension, but not on Chrome.
What you request goes against HTML standards, as far as I'm aware, in that some javascript functions are fired and override (to a degree) the close function of a tab/window. The window close confirm dialog comes to mind, but I do believe the alert dialog and the confirm dialog in general also must be addressed before closing a tab (hence why browsers will usually allow the user to block all alert and confirm dialogs from a site).
TL;DR try addons.mozilla.org, but don't expect much. You're better off asking a developer to develop it for you. To my knowledge, it shouldn't be fore than a couple of hours of coding and testing.
I think setting dom.disable_beforeunload to true in about:config in Firefox does this. I tried typing a message in the Comments on someone's picture on Facebook, and when the value is false it asks "The page is asking you to confirm that you want to leave - data you have entered may not be saved", but when it's set to true it lets me leave without the warning.
When you have an alert or confirm on screen, I don't think it allows you to close the tab unless you close the alert/confirm.