Turn off "this web page is using too much battery" on safari

enter image description hereSafari prompts "this web page is using too much battery" and restarts the web pages. Most of these pages are gmail, youtube, etc.

How to turn this feature off on macOS 10.13.6?

EDIT1: Memory - 8 GB 2133 MHz LPDDR3. Processor - 3.1 GHz Intel Core i5

EDIT2: While opening YouTube, it always says "the page was reloaded due to some error"

EDIT3: Just one extension - Grammarly

EDIT4: Another problem with YouTube (see image) (private window does not open YouTube at all) (I was currently at 3% battery at that time)


Solution 1:

You should look for the problem that is causing this trouble rather than hacking the Safari to stop showing you notifications. If it's upto to kill the process, preventing notifications will not stop it.

Here are few troubleshooting tips.

1) Check your disk space where your OS is installed. Free if needed (Swap memory reason)

2) Check your HDD & Battery health. You can get few freeware utilities.

3) Check temperature of your system. It often crash apps or even restarts the devices.

4) Clear the browser cache folder from base. See this Post for details.

5) Reset SMC

Press Shift + Control + Option + Power button at the same time. 
Release all keys and the power button at the same time.

6) Reset NVRAM

Shut down your Mac.
Press the power button.
Before the grey screen appears, press the Command, Option, P, and R keys at the same time.
Hold the keys until your computer restarts and you hear the startup sound a second time. ...
Release the keys.

7) Check for Safari and iTunes Updates.

If none of the above works and your hardware has no issues, than probably it's time to fresh install (upgrade) your OS.