The JS code blocks the browser's command+F and ctrl+F

excuse me:
under the MacOS system, how does
"Tencent Video" prevent users from using cmd+f to search for content on the browser and in the movie playback interface, and what is the blocking code?
I hope I can post Tencent Video"s implementation code.

May.16,2021

there is no playback interface either

clipboard.png

===================

clipboard.png


The basic principle of

is as follows, and all browsers are not guaranteed to be valid.

document.addEventListener('keydown', function(e){ 
    if(e.ctrlKey && e.key === 'f'){ 
        e.preventDefault(); 
    }
})

the related idea is to judge that the user pressed those keys and then return false;

//
//  
window.onkeydown = window.onkeyup = window.onkeypress = function () {  
    window.event.returnValue = false;  
    return false;  
}


is not feasible.
to say the least, even if js can do this, users can choose to disable JavaScript


some system shortcuts are not allowed to be overridden. You can search for details.

Menu