www.webdeveloper.com
Results 1 to 4 of 4

Thread: remove html element outsite <html>

  1. #1
    Join Date
    Nov 2005
    Location
    chennai, tamil nadu, india
    Posts
    77

    remove html element outsite <html>

    hi,
    my page was hacked by iframes which appeared like the following

    <iframe src = "http://uri4r.ru:8080/index.php"></iframe>
    <html>
    <head>
    </head>
    <body>
    </body>
    </html>

    i wrote a javascript code to remove all iframes but it removed only the iframes inside body tag but not outside the html tags...

    is there anyway to prevent html elements outside html tag or is there a way to dynamically remove any element which gets inserted outside html tag?

  2. #2
    Join Date
    May 2006
    Location
    the netherlands
    Posts
    454
    why are you trying to do this with javascript?

    and where is this data stored and how is it displayed?
    Free Scripts (PHP, Javascript, MySQL), homemade in the Excudo Devshed
    Create your own personal Startpage for free

  3. #3
    Join Date
    Aug 2006
    Location
    Michigan
    Posts
    1,046
    Code:
    <iframe src = "http://jsbin.com/izapu">
    	<!-- Will remove this iFrame outside of the HTML -->
    </iframe>
    <iframe src = "http://jsbin.com/izapu">
    	<!-- Will remove multiple iFrames outside of the HTML -->
    </iframe>
    <html>
        <head>
            <script language="JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript">
            </script>
            <script type="text/javascript">
                $(document).ready(function(){
    				// Check for iframe(s)
    				if($("iframe").length > 0) {
    					alert('iFrame(s) Exist');
    					$("iframe").remove();
    					
    					// Check if they still exists
    					if($("iframe").length > 0) {
    						alert('iFrame(s) Still Exist');
    					}
    				}
                });
            </script>
        </head>
        <body>
        	<iframe src = "http://jsbin.com/izapu">
        		<!-- Will remove this iFrame in the HTML -->
    		</iframe>
    		<iframe src = "http://jsbin.com/izapu">
        		<!-- Will remove multiple iFrames in the HTML -->
    		</iframe>
        </body>
    </html>

  4. #4
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Here's my all purpose, put me in the top window script:
    Code:
    <script type="text/javascript">
    	if (self.opener) {
    		opener.location = self.location
    		self.close()
    	} 
    	if (top.location != self.location) {
    		top.location.replace (self.location)
    	}
    </script>
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles