iFrame src除javascript以外的东西:false但效果相同 [英] iFrame src something other than javascript:false but same effect
问题描述
有没有其他方法可以写 javascript:false
更愉快?
Is there any other way to write javascript:false
that is more pleasant?
我正在建设内联网应用程序的打印功能(对于IE6),我使用iframe制作打印页面:
I'm building a print functionality for an intranet app (for IE6) and I make the printed page using an iframe:
$('body').append('<iframe id="printIFrame" src="javascript:false"></iframe>');
$("#printIFrame").attr('style','position:absolute;left:-500px;top:-500px;');
在src中没有 javascript:false
,当我创建它时,我会得到此页面包含安全和非安全项目弹出窗口。然而,这方面的缺点是javascript:false被打印为每页左下角的标题(而不是大约:空白或更有用的东西)。
Without having javascript:false
in the src, I'll get the "This page contains both secure and nonsecure items" popup when I create it. However the downside of this is that "javascript:false" gets printed as the title on the bottom left of each page (instead of about:blank or something more useful).
是否有某种javascript技术我可以写 javascript:false
但是用更干净的术语?我试过这样的事情
Is there some kind of javascript technique that I can write javascript:false
but in cleaner terms? I tried something like this
var PrintOut = false;
$('body').append('<iframe id="printIFrame" src="PrintOut"></iframe>');
但我无法正常工作。还有其他想法吗?
But I couldn't get that working. Any other ideas?
推荐答案
我认为你应该使用/blank.do或来自同一服务器(或来源)的东西,而不是)作为iframe的(临时?)src。然后你不应该得到不安全的东西。
为什么你想要/需要它通过javascript完成?
I think you should use a "/blank.do" or something from the same server (or origin, rather) as (temporary?) src for your iframe. Then you should not get the "insecure" stuff.
Why do you want/need it to be done by javascript?
这篇关于iFrame src除javascript以外的东西:false但效果相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!