PDA

View Full Version : Dynamic Ajax Content script - Redirect to index



Paul.G
02-09-2006, 08:26 PM
Dynamic Ajax Content script
http://www.dynamicdrive.com/dynamici...jaxcontent.htm

Hello All,
Quick question regarding the script listed above,
I want to redirect users to my index page if they link directly to my external pages instead of accessing them correctly using the Dynamic Ajax Content script?

Thanks for any help.
Paul

Twey
02-09-2006, 08:44 PM
Bad link.
Try:

<script type="text/javascript">
function checkInAJAX() {
var pageName = "file.html"; // The page name. No paths.
if(window.location.href.substr(window.location.href.indexOf("/")) == pageName) window.location.replace("/index.php");
}
</script>

Paul.G
02-09-2006, 09:13 PM
Wow quick reply :) :)
I will have a go

Thanks

Twey
02-10-2006, 07:25 AM
Slight error: should be
if(window.location.href.substr(window.location.href.indexOf("/") + 1) == pageName)