Skip to content

Commit

Permalink
Merge pull request #242 from wonknu/bug_reload_safari
Browse files Browse the repository at this point in the history
bug: iframe reload on safari
  • Loading branch information
gregorybesson committed Oct 15, 2017
2 parents dbe03d3 + 73d7f0d commit 1b71868
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/server/public/abecms/scripts/modules/EditorReload.js
Expand Up @@ -71,11 +71,14 @@ export default class Reload {
document.querySelector('#page-template').getAttribute('data-iframe-src')
)

var hasNotWritten = true

var initIframe = function() {
var doc = iframe.contentWindow.document
str = str.replace(/<\/head>/, '<base href="/" /></head>')
doc.open('text/html', 'replace')
doc.write(str)
hasNotWritten = false
doc.close()

setTimeout(function() {
Expand All @@ -92,6 +95,7 @@ export default class Reload {
}

iframe.onload = function() {
if(!hasNotWritten) return
initIframe()
setTimeout(function() {
parent.classList.remove('reloading')
Expand Down

0 comments on commit 1b71868

Please sign in to comment.