]> khamidou — GitHub mirrors - electron.git/commitdiff
Redirect history operations in renderer to browser
authorCheng Zhao <zcbenz@gmail.com>
Mon, 11 May 2015 06:29:44 +0000 (14:29 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 11 May 2015 06:29:44 +0000 (14:29 +0800)
atom/renderer/lib/override.coffee

index 6e02c2eb8222c30f6deefe5afee02d5ab3031d9c..3ac5177e809db8b023f67fb7acafeaa53a9518b7 100644 (file)
@@ -74,6 +74,12 @@ window.confirm = (message, title='') ->
 window.prompt = ->
   throw new Error('prompt() is and will not be supported.')
 
+# Forward history operations to browser.
+window.history.back = ->
+  remote.getCurrentWebContents().goBack()
+window.history.forward = ->
+  remote.getCurrentWebContents().goForward()
+
 window.opener =
   postMessage: (message, targetOrigin='*') ->
     ipc.send 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPENER_POSTMESSAGE', message, targetOrigin