2

I'm using that code to kill frames using my page:

if(self == top) {
       document.documentElement.style.display = 'block'; 
    } else {
            top.location = self.location;
    };

But I want add some exception for one domain and add another condition:

if(self == top) {
       document.documentElement.style.display = 'block'; 
    } else {
        if (window.location.host != "www.linuxportal.pl") {
            top.location = self.location;
        };
    };

But it won't work. Script kills every frame, even from www.linuxportal.pl. How to make script to kill every frame but leave frame in www.linuxportal.pl only?

eightShirt
  • 1,457
  • 2
  • 15
  • 29
QkiZ
  • 798
  • 1
  • 8
  • 19

1 Answers1

0

I resolved my problem with document.referrer

if(self == top) {
       document.documentElement.style.display = 'block'; 
    } 
else {
    if (document.referrer.indexOf("www.linuxportal.pl") >= 0 ) {
        document.documentElement.style.display = 'block';
    }
    else {
        top.location = self.location;
    }
};
QkiZ
  • 798
  • 1
  • 8
  • 19