GVKun编程网logo

z-index在iframe中的pdf中无法在Internet Explorer中使用pdf(z-index不起作用)

13

这篇文章主要围绕z-index在iframe中的pdf中无法在InternetExplorer中使用pdf和z-index不起作用展开,旨在为您提供一份详细的参考资料。我们将全面介绍z-index在i

这篇文章主要围绕z-index在iframe中的pdf中无法在Internet Explorer中使用pdfz-index不起作用展开,旨在为您提供一份详细的参考资料。我们将全面介绍z-index在iframe中的pdf中无法在Internet Explorer中使用pdf的优缺点,解答z-index不起作用的相关问题,同时也会为您带来asp.net – Jquery Ajax,不在Internet Explorer中工作、asp.net – 在iframe中显示PDF、asp.net-mvc – Kendo UI异步上传无法在Internet Explorer中运行、css url()在Internet Explorer 10中无法识别的实用方法。

本文目录一览:

z-index在iframe中的pdf中无法在Internet Explorer中使用pdf(z-index不起作用)

z-index在iframe中的pdf中无法在Internet Explorer中使用pdf(z-index不起作用)

我无法z-index处理iframe包含IE8 pdf文件的。它可以与谷歌浏览器一起使用。

HTML

<div id="div-text">      <div id="shouldBeOnTop">my text that should be on top</div></div><div id="div-frame">    <iframe src="http://legallo1.free.fr/french/CV_JLG.pdf" width="200" height="200"/></div>

CSS

#div-text{    position:relative;    left:210px;    top:20px}#shouldBeOnTop{    position:relative;    right:60px;    background-color:red;    width:100px;    z-index:2;}#div-frame{    position:relative;     z-index:1;}

答案1

小编典典

有一种方法可以用其他元素覆盖IE中的窗口元素,但是您不会喜欢它。

背景:开窗和无窗元素

旧版IE将元素分为两种类型:窗口化和无窗口化。

像普通的元素div,并input窗户 。它们由浏览器本身在单个MSHTML平面中呈现,并且相互尊重z轴的顺序。

在MSHTML外部呈现的元素带有 窗口;例如select(由OS渲染)和ActiveX控件。它们相互尊重彼此的z顺序,但是占据了一个单独的MSHTML平面,该平面绘制在所有无窗口元素的顶部。

唯一的例外是iframe。在IE 5中,iframe是一个窗口元素。IE5.5中对此进行了更改;现在它是一个没有窗口的元素,但是出于向后兼容的原因,它仍将覆盖具有较低z-index的窗口元素

换句话说: iframe 尊重z-index窗口元素和无窗口元素。如果将iframe放在窗口元素上方,iframe则位于上方的任何无窗口元素都将可见!

这是什么意思

PDF将始终在常规页面内容上绘制,就像selectIE7之前的元素一样。解决方法是iframe在您的内容和PDF之间放置另一个。

HTML:

<div id="outer">    <div id="inner">my text that should be on top</div>    <iframesrc="about:blank"></iframe></div><iframe id="pdf" src="http://legallo1.free.fr/french/CV_JLG.pdf" width="200" height="200"></iframe>

CSS:

#outer {    position: relative;    left: 150px;    top: 20px;    width: 100px;    z-index: 2;}    #inner {        background: red;    }    .cover {        border: none;        position: absolute;        top: 0;        left: 0;        height: 100%;        width: 100%;        z-index: -1;    }#pdf {    position: relative;    z-index: 1;}

支持

这已经过测试,应该可以在IE7–9中使用。如果您对在其他浏览器的DOM中显示它感到不安,则可以使用JavaScript添加它或将其包装在仅IE的条件注释中:

<!--[if IE]><iframesrc="about:blank"></iframe><![endif]-->

asp.net – Jquery Ajax,不在Internet Explorer中工作

asp.net – Jquery Ajax,不在Internet Explorer中工作

我正在尝试做一些jQuery ajax,它适用于Firfox和Chrome,但不适用于Internet Explorer 9.

最终的代码必须跨越子域,这在默认传输中不起作用.

所以我正在尝试创建一个在Internet Explorer中使用的自定义传输

方法1

$.ajaxTransport("+*",function (options,originalOptions,jqXHR) {
    if (jQuery.browser.msie && window.XDomainRequest) {
        var xdr;
        return {
            send: function (headers,completeCallback) {
                // Use Microsoft XDR
                xdr = new XDomainRequest();
                xdr.open("get",options.url);
                xdr.onload = function () {
                    if (this.contentType.match(/\/xml/)) {
                        var dom = new ActiveXObject("Microsoft.XMLDOM");
                        dom.async = false;
                        dom.loadXML(this.responseText);
                        completeCallback(200,"success",[dom]);
                    } else {
                        completeCallback(200,[this.responseText]);
                    }
                };
                xdr.ontimeout = function () {
                    completeCallback(408,"error",["The request timed out."]);
                };
                xdr.onerror = function () {
                    completeCallback(404,["The requested resource Could not be found."]);
                };
                xdr.send();
            },abort: function () {
                if (xdr) xdr.abort();
            }
        };
    }
});

我已经创建了一个简单的示例页面来演示第一种技术:
http://services.whygo.net/sendAjax.htm

请注意,如果您使用自定义传输,则正常传输将失败,除非您刷新

这个想法来自这里:
http://forum.jquery.com/topic/cross-domain-ajax-and-ie#14737000002203097

当它失败时,在$ajax上调用的’error’方法中,除了’error’之外,不会给出任何错误消息.我确实在if工具的’Network’选项卡上得到了一个405方法,但是服务器端的东西确实执行了.

方法2
我还尝试了另一种方法,如下所述:
Cross-subdomain AJAX works in Chrome,not IE

if ('XDomainRequest' in window && window.XDomainRequest !== null) {

    // override default jQuery transport
    jQuery.ajaxSettings.xhr = function() {
        try { return new XDomainRequest(); }
        catch(e) { }
     };
}

这可以在这里找到:
http://www.whygo.net/sendAjax2.html

在这个实际上,我实际上在ie工具的’network’选项卡上获得了200个代码,但是没有调用$ajax的’错误’或’成功’pararm.

如果我在第二个上加一个超时,那么它会返回’error’函数并显示’timeout’消息.

解决方法

这是我经过大约一天的努力解决这个不一致之后的解决方案……
// new method as to not overwrite jQuery's defaults
var cors = (window.XDomainRequest) ? function(url,callback) {

    var xdr = new XDomainRequest();
    xdr.open('get',url);
    xdr.onload = function() { callback(xdr.responseText); }
    xdr.send();

} : $.get; // else,use jQuery's method

使用…

cors(url,function(msg) { alert(msg); }); // pretty well same as $.get

复制和粘贴,这当然不能用于所有目的,但它是一个开始,它的工作原理.

asp.net – 在iframe中显示PDF

asp.net – 在iframe中显示PDF

我为我的网站提供了一个解决方案,使用下面的代码在整页中呈现所请求的PDF文档.现在我的客户想要在iframe中呈现文档.我似乎无法让它轻松工作,也许我错过了一些明显的东西.第一个代码将在新窗口中正确显示PDF.
if (File.Exists(filename))
        {            
            //Set the appropriate ContentType.
            Response.ContentType = "Application/pdf";
            Response.WriteFile(filename);
            Response.End();
        }
        else Response.Write("Error - can not find report");

iframe代码如下所示:

<iframe runat="server" id="iframepdf" height="600" width="800" > </iframe>

我知道我应该使用src属性作为文件名,但问题似乎是在Page_Load事件触发之前加载iframe,因此不会创建PDF.有什么明显的东西我不见了吗?

解决方法

使用ASHX处理程序. getmypdf.ashx.cs处理程序的源代码应如下所示:
using System;
using System.Web;

public class getmypdf : IHttpHandler 
{
  public void ProcessRequest(HttpContext context)
  {
        Response.ContentType = "Application/pdf";
        Response.WriteFile("myfile.pdf");
        Response.End();
  }

  public bool IsReusable 
  {
    get 
    {
      return false;
    }
  }
}

getmypdf.ashx将包含以下内容:

<% @ webhandler language="C#"%>

你的iframe看起来像这样:

<iframe runat="server" id="iframepdf" height="600" width="800" src="..../getmypdf.ashx"> </iframe>

asp.net-mvc – Kendo UI异步上传无法在Internet Explorer中运行

asp.net-mvc – Kendo UI异步上传无法在Internet Explorer中运行

我正在尝试在异步模式下使用Kendo UI Upload(MVC包装器).事情似乎在Chrome中运行良好,但在IE中没有这样的运气(截至目前仅在IE 9中测试过).当它启动上传时,我可以看到它命中我的操作方法,并且请求包含我期望的数据,但实际上没有保存任何内容.

代码示例如下:

_EditForm.cshtml(上传的位置)

@(Html.Kendo().Upload()
    .Name(string.Format("upload{0}","background"))
    .Multiple(true)
    .Events(evt => evt.Success("refreshBackgroundImages"))
    .Messages(msg => msg.DropFilesHere("drag and drop images from your computer here")
                        .Statusuploaded("Files have been uploaded"))
    .Async(a => a.AutoUpload(true)
                 .SaveField("files")
                 .Save("UploadImage","Packages",new { siteId = Model.WebsiteId,type = "background" })))

控制器ActionMethod

[HttpPost]
public ActionResult UploadImage(IEnumerable<HttpPostedFileBase> files,Guid siteId,string type)
{
        var site = _websiteService.GetWebsite(siteId);
        var path = Path.Combine(_fileSystem.OutletVirtualPath,site.Outlet.AssetBaseFolder);
        if (type == "background")
        {
            path = Path.Combine(path,_backgroundImageFolder);
        }
        else if (type == "image")
        {
            path = Path.Combine(path,_foregroundImageFolder);
        }
        foreach (var file in files)
        {
            _fileSystem.SaveFile(path,file.FileName,file.InputStream,file.ContentType,true);
        }
        // Return empty string to signify success
        return Content("");
}

解决方法

正如另一篇文章所说,“欢迎来到’为什么Internet Explorer糟透了’的第52,245,315集:

事实证明,当您在Internet Explorer中的HttpPostedFileBase上执行file.FileName时,它认为您需要本地计算机上文件的完整路径.它显然只是IE浏览器,因为Chrome和Firefox似乎都是正确的.

当您只需要实际的FileName时,请确保执行以下操作:

var filename = Path.GetFileName(file.FileName);

css url()在Internet Explorer 10中无法识别

css url()在Internet Explorer 10中无法识别

我的CSS中有这一行:
.ui-icon-zoom-in { content: url(images/16x16/ZoomIn.png); }

我和jQuery UI Button widget一起使用的是这样的:

$("#zoomin").button({ text: false,icons: { primary: "ui-icom-zoom-in" } });

在Chrome中,我可以在按钮中看到图像居中.但是,在IE10中,我没有看到图像.

我在这里错过了什么吗?

解决方法

content属性仅在伪元素之前和之后有效.您应该将其更改为:
.ui-icon-zoom-in { 
  background: url(images/16x16/ZoomIn.png) no-repeat; 
  width:16px;
  height:16px;
}

除此之外,如果指定了有效的DOCTYPE,IE8仅支持内容属性.

关于z-index在iframe中的pdf中无法在Internet Explorer中使用pdfz-index不起作用的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于asp.net – Jquery Ajax,不在Internet Explorer中工作、asp.net – 在iframe中显示PDF、asp.net-mvc – Kendo UI异步上传无法在Internet Explorer中运行、css url()在Internet Explorer 10中无法识别的相关知识,请在本站寻找。

本文标签: