2017-12-23 27 views
0

私のウェブサイトでは、フレームにGoogleのウェブサイトを表示したいと思いますが、私のエラーです: 'X-Frame-Options'を 'SAMEORIGIN'に設定したため、ポップアップライトボックスに外部リンクを追加

私はこのリンクをポップアップライトボックスに表示したいと思いますが、どうすればいいのか分かりません!!ここに私のポップアップライトボックスコードは次のとおりです。

$(document).ready(function() { 
 

 
    var id = '#dialog'; 
 

 
    //Get the screen height and width 
 
    var maskHeight = $(document).height(); 
 
    var maskWidth = $(window).width(); 
 

 
    //Set heigth and width to mask to fill up the whole screen 
 
    $('#mask').css({ 
 
    'width': maskWidth, 
 
    'height': maskHeight 
 
    }); 
 

 
    //transition effect 
 
    $('#mask').fadeIn(500); 
 
    $('#mask').fadeTo("slow", 0.9); 
 

 
    //Get the window height and width 
 
    var winH = $(window).height(); 
 
    var winW = $(window).width(); 
 

 
    //Set the popup window to center 
 
    $(id).css('top', winH/2 - $(id).height()/2); 
 
    $(id).css('left', winW/2 - $(id).width()/2); 
 

 
    //transition effect 
 
    $(id).fadeIn(2000); 
 

 
    //if close button is clicked 
 
    $('.window .close').click(function(e) { 
 
    //Cancel the link behavior 
 
    e.preventDefault(); 
 

 
    $('#mask').hide(); 
 
    $('.window').hide(); 
 
    }); 
 

 
    //if mask is clicked 
 
    $('#mask').click(function() { 
 
    $(this).hide(); 
 
    $('.window').hide(); 
 
    }); 
 

 
});
#mask { 
 
    position: absolute; 
 
    left: 0; 
 
    top: 0px; 
 
    width: 100% !important; 
 
    height: 750px !important; 
 
    z-index: 9000; 
 
    background-color: #fff; 
 
    display: none; 
 
} 
 

 
#boxes .window { 
 
    position: absolute; 
 
    left: 0!important; 
 
    top: 0px!important; 
 
    width: 100%; 
 
    height: 750px; 
 
    display: none; 
 
    z-index: 9999; 
 
    padding: 20px; 
 
    text-align: center; 
 
} 
 

 
#boxes #dialog { 
 
    left: 0!important; 
 
    top: 0px!important; 
 
    width: 100%; 
 
    height: 750px; 
 
    padding: 10px; 
 
    background-color: #ccc; 
 
    font-family: 'Segoe UI Light', sans-serif; 
 
    font-size: 15pt; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<div id="boxes"> 
 
    <div id="dialog" class="window"> 
 
    Your Content Goes Here 
 
    </div> 
 
    <div id="mask"></div> 
 
</div>

有効な私のポストに多くのテキストを追加する必要がありますが、すべてが言われています!

答えて

0

を使用すると、外部URLのコンテンツを表示できます。これは、すべてのURLで有効になりません.の設定では、ページをに埋め込むことができなくなります。ここでは一例です

$(id).html(`<iframe src="https://www.theonion.com/" frameborder="0" width="100%" height="100%" ></iframe>`); 

$(document).ready(function() { 
 

 
    var id = '#dialog'; 
 
    
 
    $(id).html(`<iframe src="https://www.theonion.com/" frameborder="0" width="100%" height="100%" ></iframe>`); 
 

 
    //Get the screen height and width 
 
    var maskHeight = $(document).height(); 
 
    var maskWidth = $(window).width(); 
 

 
    //Set heigth and width to mask to fill up the whole screen 
 
    $('#mask').css({ 
 
    'width': maskWidth, 
 
    'height': maskHeight 
 
    }); 
 

 
    //transition effect 
 
    $('#mask').fadeIn(500); 
 
    $('#mask').fadeTo("slow", 0.9); 
 

 
    //Get the window height and width 
 
    var winH = $(window).height(); 
 
    var winW = $(window).width(); 
 

 
    //Set the popup window to center 
 
    $(id).css('top', winH/2 - $(id).height()/2); 
 
    $(id).css('left', winW/2 - $(id).width()/2); 
 

 
    //transition effect 
 
    $(id).fadeIn(2000); 
 

 
    //if close button is clicked 
 
    $('.window .close').click(function(e) { 
 
    //Cancel the link behavior 
 
    e.preventDefault(); 
 

 
    $('#mask').hide(); 
 
    $('.window').hide(); 
 
    }); 
 

 
    //if mask is clicked 
 
    $('#mask').click(function() { 
 
    $(this).hide(); 
 
    $('.window').hide(); 
 
    }); 
 

 
});
#mask { 
 
    position: absolute; 
 
    left: 0; 
 
    top: 0px; 
 
    width: 100% !important; 
 
    height: 750px !important; 
 
    z-index: 9000; 
 
    background-color: #fff; 
 
    display: none; 
 
} 
 

 
#boxes .window { 
 
    position: absolute; 
 
    left: 0!important; 
 
    top: 0px!important; 
 
    width: 100%; 
 
    height: 750px; 
 
    display: none; 
 
    z-index: 9999; 
 
    padding: 20px; 
 
    text-align: center; 
 
} 
 

 
#boxes #dialog { 
 
    left: 0!important; 
 
    top: 0px!important; 
 
    width: 100%; 
 
    height: 750px; 
 
    padding: 10px; 
 
    background-color: #ccc; 
 
    font-family: 'Segoe UI Light', sans-serif; 
 
    font-size: 15pt; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<div id="boxes"> 
 
    <div id="dialog" class="window"> 
 
    
 
    </div> 
 
    <div id="mask"></div> 
 
</div>

+0

基本的には同じように、表示したいURLにsrcセットでにご#dialogのHTMLを設定しますあなたのコードはGoogleのウェブサイトで動作することができますか? –

関連する問題