-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to use main window window.history #444
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,7 +265,7 @@ spf.history.doPushState_ = function(data, title, opt_url) { | |
// This check makes sure that pushState is a function when called to | ||
// avoid js errors and a state where the back arrow stops working. | ||
var iframe = spf.history.getIframe(); | ||
var pushState = iframe.contentWindow.history.pushState; | ||
var pushState = iframe.history.pushState; | ||
if (typeof pushState == 'function') { | ||
pushState.call(window.history, data, title, opt_url); | ||
} else { | ||
|
@@ -282,7 +282,7 @@ spf.history.doPushState_ = function(data, title, opt_url) { | |
*/ | ||
spf.history.doReplaceState_ = function(data, title, opt_url) { | ||
var iframe = spf.history.getIframe(); | ||
var replaceState = iframe.contentWindow.history.replaceState; | ||
var replaceState = iframe.history.replaceState; | ||
if (typeof replaceState == 'function') { | ||
replaceState.call(window.history, data, title, opt_url); | ||
} else { | ||
|
@@ -292,12 +292,21 @@ spf.history.doReplaceState_ = function(data, title, opt_url) { | |
|
||
|
||
/** | ||
* @return {!HTMLIFrameElement} The history iframe. | ||
* @return {!Window} The history iframe. | ||
*/ | ||
spf.history.getIframe = function() { | ||
var frame = document.getElementById('history-iframe'); | ||
if (!frame) { | ||
frame = spf.dom.createIframe('history-iframe'); | ||
var frame = null; | ||
if (spf.config.get('use-iframe')) { | ||
frame = document.getElementById('history-iframe'); | ||
|
||
if (!frame) { | ||
frame = spf.dom.createIframe('history-iframe'); | ||
} | ||
|
||
frame = frame.contentWindow; | ||
} else { | ||
frame = window | ||
} | ||
return /** @type {!HTMLIFrameElement} */ (frame); | ||
|
||
return /** @type {!Window} */ (frame); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ff There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,7 @@ spf.main.init = function(opt_config) { | |
*/ | ||
spf.main.canInit_ = function() { | ||
return !!(typeof window.history.pushState == 'function' || | ||
spf.history.getIframe().contentWindow.history.pushState); | ||
spf.history.getIframe().history.pushState); | ||
}; | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. w There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nah |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hello