リファラ実験

Updated: 2005-05-22 03:54:29+0900 [Home]

直にリンク

リファラ表示ページに直にリンクします。

HTTPヘッダのLocationを使用する

HTTPヘッダでLocationを使用します。

header("Location: http://www.teria.com/~koseki/memo/referrer/view.php");

Locationヘッダ→Locationヘッダ→リファラ表示

繰り返しても同じでした。

header("Location: http://www.teria.com/~koseki/memo/referrer/location.php");

HTTPヘッダのRefreshを使用する

HTTPヘッダでRefreshを使用します。

header("Refresh: 0; URL=http://www.teria.com/~koseki/memo/referrer/view.php");

METAタグのRefreshを使用する

METAタグのRefreshを使用します。

<html>
<head>
<title>refresh tag</title>
<meta http-equiv="Refresh" content="0; URL=http://www.teria.com/~koseki/memo/referrer/view.php">
</head>
<body></body>
</html>

METAタグRefresh→Locationヘッダ→リファラ表示

Refreshでリファラを消した後、そのページのURLをリファラにしてLocationヘッダで飛ばせないか、という実験。リファラの書き換えができるかも、とかすかな期待を込めて。

<html>
<head>
<title>refresh tag</title>
<meta http-equiv="Refresh" content="0; URL=http://www.teria.com/~koseki/memo/referrer/location.php">
</head>
<body></body>
</html>

Lynxだけが、期待した動作をするみたいです。リファラの書き換えって問題あるのかな……。

JavaScriptでlocation.hrefを使用

JavaScriptでlocation.hrefにリダイレクト先のURLを代入します。「戻る」ボタンで戻れなくなります。迷惑です。

<html>
<head>
<title>location.href</title>
</head>
<body>
<script language="JavaScript">
location.href="http://www.teria.com/~koseki/memo/referrer/view.php";
</script>
</body>
</html>

JavaScriptでlocation.replace()を使用

JavaScriptでlocation.replace()を使って移動します。リダイレクト用のページがブラウザの履歴に残りません。

<html>
<head>
<title>location.href</title>
</head>
<body>
<script language="JavaScript">
location.replace("http://www.teria.com/~koseki/memo/referrer/view.php");
</script>
</body>
</html>

JavaScriptでlocation.assign()を使用

JavaScriptでlocation.assign()を使って移動します。URLをブラウザに読み込む……って、何に使うんだろう、これ。

<html>
<head>
<title>location.assign</title>
</head>
<body>
<script language="JavaScript">
location.assign("http://www.teria.com/~koseki/memo/referrer/view.php");
</script>
</body>
</html>

JavaScriptでMETA Refreshをdocument.write()

JavaScriptでmetaタグをdocument.write()することで、リファラを送らないリンクを作成できるそうです。

<html>
<head>
<script language="JavaScript">
<!--
OpenExtLink = function(el){
  var url = el.href;
  w = window.open();
  w.document.write('<meta http-equiv="refresh" content="0;url='+url+'">');
  w.document.close();
  return false;
};
-->
</script>
</head>
<body>
<a onClick="return OpenExtLink(this)" href="./view.php" target="_blank">
extra link </a>
</body>
</html>

KOSEKI Kengo <kengo at tt.rim.or.jp>