The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 03, 2010, 05:40:48 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: breaking the iframe breaker  (Read 1491 times)
svakanda
Expert
****
Offline Offline

Posts: 122



View Profile
« on: June 30, 2009, 09:36:12 AM »

This snippet pretty effectively trashes your iframes...
Code:
if (top.location != location) {
top.location.href = document.location.href ;
}

I am sure there must be a way to combat that.  Anyone have any suggestions?  I know pretty much zero javascript.

thanks!
Logged

a ship is safe in the harbor, but that's not what it's for.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1598



View Profile
« Reply #1 on: June 30, 2009, 09:55:33 AM »

Easy way with IE:

Code:
var top.location = function(){
return null;
}

Then there is another way that works 100% but it will stop all other js on the page after the attempted framebreak from loading.
Logged

svakanda
Expert
****
Offline Offline

Posts: 122



View Profile
« Reply #2 on: June 30, 2009, 11:06:01 AM »

Can you show me that one too VS?  That sounds preferable to me actually.

thanks so much!
J
Logged

a ship is safe in the harbor, but that's not what it's for.
svakanda
Expert
****
Offline Offline

Posts: 122



View Profile
« Reply #3 on: September 30, 2009, 01:34:06 AM »

Doesn't appear to work with IE8  & this framebreaker...

Code:
if(top.location!=location){top.location.href=document.location.href;}

Maybe I need to go find some IE 6/7 to test with.  Is there a good way I can get those without having to like...validate and all that shit?
Logged

a ship is safe in the harbor, but that's not what it's for.
nop_90
Global Moderator
Lifer
*****
Online Online

Posts: 1899


View Profile
« Reply #4 on: September 30, 2009, 04:11:16 AM »

top = null;
window = null;
document = null;

 ROFLMAO
Logged
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1598



View Profile
« Reply #5 on: September 30, 2009, 06:19:47 AM »

You need a script that sends a 500 something header. I can't remember what it is off the top of my head, but Javascript dies a flaming horrible death when you get an ajax response with this particular header type, which is how you get framebreaker code to keep from executing. The HUGE caveat is that no further JS will execute on the page. At All.
Logged

kurdt
Lifer
*****
Online Online

Posts: 1013


it's all part of the plan


View Profile
« Reply #6 on: September 30, 2009, 10:02:30 AM »

You need a script that sends a 500 something header. I can't remember what it is off the top of my head, but Javascript dies a flaming horrible death when you get an ajax response with this particular header type, which is how you get framebreaker code to keep from executing. The HUGE caveat is that no further JS will execute on the page. At All.
You  mean 204 No Content? At least I have used that with frame breaker and it works but it cripples the browser nicely. Visitor can't exit from your page and do nothing than close it when he wants to leave Devilish
Logged

Coming up with new features is easy - inventing features that replace old features is hard.
svakanda
Expert
****
Offline Offline

Posts: 122



View Profile
« Reply #7 on: September 30, 2009, 11:05:36 AM »

yeah that is my experience too Kurdt, it totally cripples IE, firefox it halts in it's tracks, but it still works.  IE prettymuch = dead.  I'd prefer if that weren't the case actually.
Logged

a ship is safe in the harbor, but that's not what it's for.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1598



View Profile
« Reply #8 on: September 30, 2009, 12:08:12 PM »

Right, the 204 header. That's what I was thinking of.
Logged

perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 8744



View Profile
« Reply #9 on: September 30, 2009, 12:56:22 PM »

Code:
var top.location = function(){
return null;
}

Sometimes the simplest shit you come out with is solid gold. Never thought of it this way, really nice VS.
« Last Edit: September 30, 2009, 01:22:06 PM by perkiset » Logged

It's the things you learn after you know it all that really count.
-John Wooden
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1598



View Profile
« Reply #10 on: September 30, 2009, 01:19:36 PM »

/blushes

seriously though remember, that only works in IE! FF is smart enough not to let you redefine the methods of globally accessible objects, hehe.
Logged

Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!