EasyUI panel/window embed iframe pdf 无效

奇怪的是,如果你直接 放在一个 新页面上展示,是可以的,换成页面上 jq 插入 的 embed object iframe 就不显示,embed和object连请求 都不发

<div id="pdfView" class="easyui-window" style="width:800px;height:600px">

    <div class="panel panel-default">
        <div class="panel-heading" style="text-align: left">
            <label style="width:100px">流水号:</label><input id="cus_no" type="text"  style="width:150px" >
            <a style="width:80px;"  class="easyui-linkbutton c1" onclick="SaveCustomflowNo()">保存</a>
        </div>
        <div id="embed_div" class="panel-collapse collapse">
            <embed id="pdf_embed" style="width:100%;height:100%" />
        </div>
    </div>

</div>


<script>

 function onDblClickRow(index, row) {

            $("#embed_div embed").remove();

             //这里无论是 object embed 或iframe(ifram 会回发到后台)都 不显示pdf

var pdfurl = "/Delgt_Attaches/GetStream?id=" + row.ID;

var pdfhtm   ="<object id='pdf_obj'  src= '"+pdfurl +"' ></object>" ; //不会回发

pdfhtm = "<iframe id='pdf_ifm' src= '"+pdfurl +"' />";//会回发到后台,但不显示pdf

pdfhtm = "<embed id='pdf_embed' src= '"+pdfurl +"' />";//不会回发

            $("#embed_div").append(pdfhtm);

           //$("body").append(pdfhtm);//可以展示

            $('#pdfView').window('open');

            $('#pdfView').window('center');

}

</script>


新页面html

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>委托附件查看</title>
    <link href="/Scripts/easyui/themes/metro/easyui.css" rel="stylesheet">
    <link href="/Scripts/easyui/themes/color.css" rel="stylesheet">
    <script src="/Scripts/jquery-2.1.1.js"></script>
    <script src="/Scripts/easyui/jquery.easyui.min.js"></script>
</head>
<body>
    <div id="pdfView" class="easyui-window" style="width:100%;height:100%">
        <div class="panel panel-default">
            <div class="panel-heading" style="text-align: left">
                <label style="width:100px">关务流水号:</label>
                <input id="cus_no" type="text" style="width:150px">
                <a style="width:80px;" class="easyui-linkbutton c1" onclick="SaveCustomflowNo()">保存</a>
            </div>
            <div id="pdfembed_div" class="panel-collapse collapse">
                @*<embed src="GetStream?ftpFilePath=@(ViewBag.ftpFilePath??"")" style="width:100%;height:90%" type="application/pdf">*@
                <object id="pdfObj" type="application/pdf" src="GetStream?ftpFilePath=@(ViewBag.ftpFilePath??"")" style="width:100%;height:90%"></object>
            </div>
        </div>
    </div>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/foreverhot1019/article/details/80475199
今日推荐