4

I've got into a peculiar situation with Chrome on my Samsung Note 2 running Android 4.4.2. I've been playing with JavaScript and apparently created some bad code. I know it because PhpStorm showed the warning that the code was likely to cause an exception. Still, I've tried seeing this page on my smartphone. (I need the smartphone because I am playing with the navigator.vibration function.) Chrome crashed.

Now when I run Chrome, it tries to re-open all tabs, the last being the one with the erroneous page (hosted with a web-hosting company). Apparently, Chrome is trying to open the cached page. It makes the whole smartphone practically unresponsive, with app icons sometimes disappearing from the desktop. I can revive the OS by closing Chrome from the app manager (long-press the home key).

I have already corrected the page online, it works fine in a desktop browser. And no warning in PhpStorm any more. But Android Chrome is hopeless. Restarting the phone doesn't help.

I wonder if I can somehow reset Chrome or simply close all tabs without running Chrome itself. It would also be great to understand what could have brought it to this amazing condition.

The problematic code in the page was

while (true) {
    navigator.vibrate([500, 500]);
} 

I wanted to create an infinite loop (for as long as the tab was open).

2

You could try killing Chrome and then clearing cache in the settings app.

  • Awesome, that seems to be what I was looking for! Thanks! – texnic May 4 '16 at 12:27
  • @texnic Glad I could help. – Njinx May 4 '16 at 18:43
3

Just in case no better answer is given, I found a workaround by mere chance. Another program (Play Store) decided to open some web-page. Since Chrome was a default browser, it launched Chrome with a new tab. This means that the last opened tab (which was my problematic one) was not made active and hence Chrome hasn't tried to display it. I was then able to close that tab as usual, and then open it again. This time Chrome downloaded the content from the web and since I corrected it, the problem was resolved.

  • TEXNIC- your workaround answer worked perfectly. the simple backdoor is sometimes the easiest option, so thank you! – user183193 Aug 17 '16 at 2:41
2

You have to have it set to false because any infinite loop in javascript will crash the browser. The reason it is not crashing on the desktop is probably because it ingroring the function. Sorry if my understadning is wrong im not too good at javascript.

  • Actually, now I know that I should use setInterval. – texnic May 3 '16 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.