Javascript - Redirect Code

The follow code DOES WORK, however not as I want it TO.

I have a domain FRAMED / Redirect to a free blogging site. at the BLOGGING site I have to following code in the header to redirect to my domain name.

WHAT IS HAPPENING IS AS YOU CAN GUEST IT is going into a loop.

WHAT I am trying to do is get the LINK juice SERP to the domain name. SO the java code is right but I want it to quit ONCE after the redirect / forward.

as the site is in FRAME once directed to the domain name it STICKS…on the domain name.

<script language=‘javascript’>
document.location=‘http://www.GOOGLE.COM/’;
</script>

I am new VERY new to javascript

Whoah man, easy with the CAPITALIZED TEXT. It looks like you’re yelling at us.

And, you haven’t posted the code.

I’m sorry, all I can offer is an Algorithm.

Maybe then you must consider using a GET variable… from Google to your domain, www.yourdomain.com, from your domain to Blog… www.yourblog.com/index.php?ref=goback… and back to your domain www.yourdomain.com?ref=fromblog… when “ref” value touches “fromblog”, stop immediately.

If this were PHP, I could help you with some code, but this being JS, sorry…

This can be done in PHP btw…

yourdomain.com - at the beginning of index.php:


<?php
  if(!isset($_GET['ref']) || $_GET['ref'] != 'fromblog')
  {
    header('location: yourblog.php?ref=goback');
  }
?>

yourblog.com - at the beginning of the home file:


<?php
  if($_GET['ref'] == 'goback')
  {
    header('location: yourdomain.com/index.php?ref=fromblog');
  }
?>

Sorry about the quip about the capitalization :slight_smile:

The codE is with the OP POst, thanks

Keyboard issues, keys get stuck.

I am hoping fo r help thanks.