Forum Moderators: open
I attempted some different ways by simulating this on 2 different sites i have. I tried getting top.location.href and all sorts of other detection methods, but for some reason, when the page is in a frame on another site, top.location.href ends the script and doesn't work, while it gets the proper data from my site, example.com.
Is there any other way to detect the top address?
and NO. I do NOT want a break out script. The point is keeping the page in a frame, only on a certain address.
Your script only needs to detect that your domain is top, and it doesn't matter what the actual domain is if that's not the case. So you test with an "if" statement, and then use replace() to load the intended top URL if your intended URL is not top - and it doesn't matter what the top url is if it isn't your page.