1

I have a friendly function:

var crashBrowser  = function(){

  var total = "";                
  for( var i = 0; i < 100000; i++ ) {

      total = total + i.toString();
      history.pushState(0,0, total );

  } 

}

On calling crashBrowser() when the site runs on http:// works fine but why is there a problem when called locally with file:// in the URL

I looked through the JS error , it said file:// is not supported .I would like to know the reason if there is.

Tilak Madichetti
  • 4,110
  • 5
  • 34
  • 52
  • Well, this is not your function, you got it from one of the "crashxyz.com" sites. – Bálint Dec 04 '16 at 08:43
  • I suspect this is a situation where the browser is trying to prevent XSS attacks on local files. http://stackoverflow.com/a/13348807/367865 – Ouroborus Dec 04 '16 at 08:57

1 Answers1

0

The history editing functions need the website to be accessed via the HTTP protocol, this is due to many security reasons. Opening files locally won't work because they are accesed via the file protocol.

Bálint
  • 4,009
  • 2
  • 16
  • 27