diff --git a/src/render_iframe.js b/src/render_iframe.js index 791d75a..2f7cf35 100644 --- a/src/render_iframe.js +++ b/src/render_iframe.js @@ -31,11 +31,7 @@ EPUBJS.Render.Iframe.prototype.load = function(chapter){ var render = this, deferred = new RSVP.defer(); - render.document = render.iframe.contentDocument; - - // this.iframe.contentWindow.location.replace(url); - chapter.render().then(function(contents){ - + chapter.url().then(function(url){ // Reset the scroll position render.leftPos = 0; @@ -44,6 +40,7 @@ EPUBJS.Render.Iframe.prototype.load = function(chapter){ } this.iframe.onload = function(e) { + render.document = render.iframe.contentDocument; render.docEl = render.document.documentElement; render.headEl = render.document.head; render.bodyEl = render.document.body; @@ -68,10 +65,7 @@ EPUBJS.Render.Iframe.prototype.load = function(chapter){ }); }; - - this.document.open(); - this.document.write(contents); - this.document.close(); + this.iframe.contentWindow.location.replace(url); }.bind(this));