Find and remove IFrame
A Iframe is dynamically add just after BODY tag and it breaks my all site, So i 开发者_开发问答want to find IFrame which is just after BODY tag and remove it using JQuery. It also adds some Js so, i want also to remove this. Please help me.
HTML Markup
<body>
<iframe></iframe>
<script type="text/javascript">
//<![CDATA[
(function(){
var c = document.body.className;
c = c.replace(/no-js/, 'js');
document.body.className = c;
})();
//]]>
</script>
var el = document.getElementsByTagName("iframe")[0];
el.parentNode.removeChild(el);
or if the #id is static
$("#conash3D0").remove();
Instead of just removing it from jquery you need to check the rest of your site. You're a victim of an ifram injection attack. You should check your server and the machines you use to connect to it via FTP for any malware.
Take a look at these:
http://www.diovo.com/2009/03/hidden-iframe-injection-attacks/
http://faiz.kera.la/2009/04/12/server-side-code-cleaner-in-aspnet-for-iframe-injection-attack/
You could use the .remove()
function:
$(function() {
$('#conash3D0').remove();
});
Try
$("#conash3D0").remove();
精彩评论