From c2394da2d96384dd35d701ecd1c707994dfc2d1a Mon Sep 17 00:00:00 2001 From: Gijs Date: Mon, 14 Mar 2016 19:57:53 +0000 Subject: [PATCH] Fix #272 by not using 'location' as a variable ... because it writes to window.location when used in a browser context, which is a bad idea. Using 'loc' instead fixes this. --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c1fea92..ee48bca 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,13 @@ To test local changes to Readability.js, you can run your own instance of [reada To parse a document, you must create a new `Readability` object from a URI object and a document, and then call `parse()`. Here's an example: ```javascript -var location = document.location; +var loc = document.location; var uri = { - spec: location.href, - host: location.host, - prePath: location.protocol + "//" + location.host, - scheme: location.protocol.substr(0, location.protocol.indexOf(":")), - pathBase: location.protocol + "//" + location.host + location.pathname.substr(0, location.pathname.lastIndexOf("/") + 1) + spec: loc.href, + host: loc.host, + prePath: loc.protocol + "//" + loc.host, + scheme: loc.protocol.substr(0, loc.protocol.indexOf(":")), + pathBase: loc.protocol + "//" + loc.host + loc.pathname.substr(0, loc.pathname.lastIndexOf("/") + 1) }; var article = new Readability(uri, document).parse(); ```