My question is: How can I convince also Chrome/Opera and Firefox that a specific input is focused when/after the page is loaded (by using autofocus) AND also its text is selected by default.
The closest answers to my use case are about how to select the text of an input when the element gets focus by clicking on it.
The most appropriate answer (imho) to my question would be:
// file: scripts.js
function onFocusSelectAll(sender) {
// setTimeout(function () { ... }, 0) is required for edge and safari
setTimeout(function() {
sender.select();
}, 0);
}
<input id="searchInput" type="text" onfocus="onFocusSelectAll(this);">
Taken and modified from this SO answer
But that's just half the truth. Although this works in many browsers (edge, IE, Safari) no text will be selected in Chrome/Opera or Firefox