iFrame只能显示源代码吗? [英] Can an iFrame display source code only?

查看:66
本文介绍了iFrame只能显示源代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iFrame是否可以显示源的原始代码而不是将其呈现出来?如果是这样,您该怎么做?可以在JavaScript上完成吗?

Is possible for an iFrame to show the raw code of a source rather than rendering it out? If so how do you do that and can it be done on JavaScript?

推荐答案

不是直接的,但是没有理由用Javascript无法完成.进行AJAX调用以获取HTML源代码,对一些关键字符进行HTML编码,然后将结果设置为框架或其他元素的内容.

Not directly, but there's no reason it cannot be done with Javascript. Make an AJAX call to fetch the HTML source, HTML-encode a few key characters, and set the result as the contents of your frame or other element.

这篇关于iFrame只能显示源代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆