I Want to show a site in my site using iframe.. but the target site has implemented an iframe buster code as below- try { if (top.location.hostname != self.location.hostname) throw 1; } catch (e) { top.location.href = self.location.href; } Now how to stop iframe from being redirected to the target site. i have got a solution here - http://coderrr.wordpress.com/2009/02/13/preventing-frame-busting-and-click-jacking-ui-redressing/ but dont know how to do that..???
You need to replace "http://server-which-responds-with-204.com" in the code with an address to some real site which actually responds with "HTTP/1.1 204 No Content", and then add the modified code to your site.
thanx dude.. but please can you tell me how to make an http 204 no content page.. or any other page which responds to such error...
It depends on what the content you are trying to load within the iframe, if it is just static html then you could easily create a server-side proxy to load the data. If it is not then I can't see an easy solution... You could try maybe creating a hidden iframe that points to the server you are trying to load and add the attributes name="top" id="top". Not sure if it would work though...
e.g: <iframe src="http://urlofiframe.com" id="top" name="top" style="display: none;"></iframe> Code (markup):