Sites like github.com are causing CPU overload

I have disabled JavaScript access to the clipboard in my browser settings and have recently experienced frustration with the behavior of github.com in continually checking for clipboard support. I have discovered that github.com erroneously checks for clipboard support by checking the navigator.clipboard.read function, without taking into account whether the navigator.clipboard object is undefined, which can lead to an infinite loop that spikes CPU usage.

I have found a temporary workaround by defining and injecting the navigator.clipboard object myself, creating a dummy object with the read and write functions set to zero (or some arbitrary non-function value). This solution effectively stops the infinite loop from occurring and tricks the website into thinking that clipboard support is disabled.

(function() { 
/* fix: when sites ask for a clipboard such as github.com 
* in navigator-clipboard.js causing CPU-overload! */ 
navigator.clipboard = { 
    read  : 0, 
    write : 0, 
}; 
}()); 

It’s important to note that other users who have not disabled clipboard access in their browser settings may not have experienced this issue. However, the solution provided may still be helpful for those who have disabled clipboard access and are experiencing similar issues with github.com’s clipboard support check.