yyx748 Posted August 1, 2009 Share Posted August 1, 2009 I made my php website using iframe. U can see the pages refreshes in the same area http://www.sgdrugstore.com However, when i enter the url directly in browsers will result in this http://www.sgdrugstore.com/prod.php http://www.sgdrugstore.com/product.php?id=27 Question is how do i do some sort of checking whether the page is loaded within the iframe or not? In javascript its something like this if (self == top){ var url = self.location.pathname; self.location = "index.php?" + url; // name of parent page } I know the concept of how to do it in php but i juz dunno how to type this line in php....how do i type this line?? self == top This is my concept In other pages checking if its self=top if top, create cookie In home page check if cookie exist if exist then redirect iframe src to that cookie page Anyone can help me or have any other methods? Link to comment https://forums.phpfreaks.com/topic/168377-iframe-redirecting-to-main-window/ Share on other sites More sharing options...
gevans Posted August 1, 2009 Share Posted August 1, 2009 There isn't a way to do this in php. You're wanting to test a client side feature with a server side script. Why not instead of suing a n iframe. Have a div and use php to pull in the content and print it inside that div. That gets rid of the irfame (iframe's area nasty anyway) and will give you control over testing the page via php, you can make sure that the 'inner' page isn't getting called directly. Link to comment https://forums.phpfreaks.com/topic/168377-iframe-redirecting-to-main-window/#findComment-888306 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.