diff --git a/core/modules/responsive_preview/js/responsive-preview.js b/core/modules/responsive_preview/js/responsive-preview.js index 0105ac0..44637e4 100644 --- a/core/modules/responsive_preview/js/responsive-preview.js +++ b/core/modules/responsive_preview/js/responsive-preview.js @@ -633,15 +633,9 @@ Drupal.responsivePreview = Drupal.responsivePreview || { // CSS. .css('padding', this.bleed); // Attach the iframe that will hold the preview. - $(Drupal.theme('responsivePreviewFrame')) - .attr({ - 'data-loading': true, - src: drupalSettings.basePath + Drupal.encodePath(drupalSettings.currentPath), - width: '100%', - height: '100%' - }) + var $frame = $(Drupal.theme('responsivePreviewFrame')) // Load the current page URI into the preview iframe. - .on('load.responsivepreview', $.proxy(this._refresh, this)) + .on('load.responsivepreview', this._refresh.bind(this)) // Add the frame to the preview container. .appendTo($frameContainer); // Wrap the frame container in a pair of divs that will allow for @@ -665,6 +659,8 @@ Drupal.responsivePreview = Drupal.responsivePreview || { .append($frameContainer) // Append the container to the body to initialize the iframe document. .appendTo('body'); + // Load the path into the iframe. + $frame.get(0).contentWindow.location = Drupal.url(drupalSettings.currentPath); // Mark the preview element processed. this.model.set('isBuilt', true); }, @@ -1069,7 +1065,7 @@ $.extend(Drupal.theme, { * The corresponding HTML. */ responsivePreviewFrame: function () { - return ''; + return ''; } });