Skip to content

Commit

Permalink
Some navigator properties and functions backed up.
Browse files Browse the repository at this point in the history
All the standard (and a couple of non-standard) properties and functions
are now accessible. Plugins is not. This seems to generate optimal
results.
  • Loading branch information
KatrinaHoffert committed Mar 25, 2014
1 parent d0c38bf commit daa6c7d
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions scripts/injected.js
Expand Up @@ -60,9 +60,35 @@ function run(listedStatus)
window.location.href);
}

// Possibly a way to inject javascript directly into the page
var injectedCode = ['window.navigator = null; window.navigator = {};'];
// The code to inject
var injectedCode = [' \
var backup = {}; \
backup.appCodeName = window.navigator.appCodeName; \
backup.appName = window.navigator.appName; \
backup.appVersion = window.navigator.appVersion; \
backup.battery = window.navigator.battery; \
backup.connection = window.navigator.connection; \
backup.cookieEnabled = window.navigator.cookieEnabled; \
backup.geolocation = window.navigator.geolocation; \
backup.javaEnabled = window.navigator.javaEnabled; \
backup.language = window.navigator.language; \
backup.mimeTypes = window.navigator.mimeTypes; \
backup.onLine = window.navigator.onLine; \
backup.oscpu = window.navigator.oscpu; \
backup.platform = window.navigator.platform; \
backup.product = window.navigator.product; \
backup.userAgent = window.navigator.userAgent; \
backup.buildID = window.navigator.buildID; \
backup.id = window.navigator.id; \
backup.doNotTrack = window.navigator.doNotTrack; \
backup.registerContentHandler = window.navigator.registerContentHandler; \
backup.registerProtocolHandler = window.navigator.registerProtocolHandler; \
backup.vibrate = window.navigator.vibrate; \
window.navigator = null; \
window.navigator = backup; \
'];

// Create a script tag with the injected code
var script = document.createElement('script');
script.textContent = injectedCode;
(document.head||document.documentElement).appendChild(script);
Expand Down

0 comments on commit daa6c7d

Please sign in to comment.