Log in

View Full Version : Redirect to iFrame



kaos
10-13-2009, 02:25 AM
Hi

I'm currently using the following script to redirect my visitors. my site uses an iFrame and i don't want them to see the pages it contains except through it. this script redirects them if they're not viewing the page in an iFrame.


if (parent.frames.length != 0) {
// loaded in frames
}
else {
// not loaded frames
window.location.href = 'http://www.mydomain.com/'
}

This works nice and all, but i'd like it to redirect the users to a unique page depending on they're original request. any ideas???:confused:

kaos
10-26-2009, 10:46 PM
never mind, i made a solution:


var url = window.location.href;
var page = url.split("http://www.mydomain.com");

if (parent.frames.length != 0) {
// loaded in frames
}
else {
// not loaded frames
window.location.href = 'http://www.mydomain.com/?fs=' + page[1] +''
}