簡體   English   中英

ASP.Net Core - Razor WebApp - 頁面包含 IFrame 時的奇怪行為

[英]ASP.Net Core - Razor WebApp - strange behavior when Page contains an IFrame

我剛剛制作了一個新的 ASP.Net Core 3.1 Razor WebApplication。 然后我添加一個名為 Test.cshtml 的新 Razor 頁面:

@page
@model StackOverflow.Pages.TestModel
@{
    ViewData["Title"] = "Page with IFrame";
}
<h1 class="display-4 text-center">@ViewData["Title"]</h1>
<div>
    <iframe frameborder="0" heigth="100%" width="100%" style="height:600px"/>
</div>

然后我在 _Layout.cshtml 中添加指向這個新頁面的鏈接:

<li class="nav-item">
    <a class="nav-link text-dark" asp-area="" asp-page="/Test">Test</a>
</li>

在 _Layout.cshtml 中是一個 @RenderBody 頁面的內容應該是可見的 - 然后是下面的頁腳。

<div class="container">
    <main role="main" class="pb-3">
        @RenderBody()
    </main>
</div>

<footer class="border-top footer text-muted">
    <div class="container">
        &copy; 2022 - StackOverflow - <a asp-area="" asp-page="/Privacy">Privacy</a>
    </div>
</footer>

運行網站時 - 測試頁面顯示正常 - 帶有一個空的 Iframe - 但是在查看其他頁面時出現的頁腳 - 在顯示帶有 IFrame 的測試頁面時不可見。

只是想知道為什么?

<iframe frameborder="0" heigth="100%" width="100%" style="height:600px"/>

該問題與iframe標簽有關,嘗試修改如下:

<iframe frameborder="0" heigth="100%" width="100%" style="height:600px"></iframe>

然后,結果是這樣的:

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM