INDEX
概要
ウェブページで別のページに飛ばす、リダイレクトの方法とそのときのリファラーの値。
| No | リダイレクト方法 | IE 6.0 | Fx 1.5 |
|---|---|---|---|
| C0 | HTTP Location ヘッダ | LINK元 | LINK元 |
| C1 | Aタグ リンククリック | go.cgi | go.cgi |
| C2 | Metaタグ Refresh | (none) | (none) |
| C3 | JavaScript location.href | (none) | go.cgi |
| C4 | JavaScript location.assign() | (none) | go.cgi |
| C5 | JavaScript location.replace() | (none) | go.cgi |
| C6 | JS document.write() + Metaタグ | (none) | (none) |
| H1 | HTML + JavaScript location | (none) | go.html |
| H2 | HTML + JavaScript + Metaタグ | (none) | (none) |
infoseek isweb ライト の cgiの呼び出し制限
Referer に "infoseek.co.jp" が含まれている、もしくは、空でないと 403 Forbidden になる。(iswebライトのみ)
- infoseek isweb / サーバーの仕様に関する情報
BIGLOBE 個人ホームページ の cgiの呼び出し制限
- BIGLOBE - CGIの利用について
HTTP Location ヘッダ
CGIでHTTPのLocationヘッダを出力して目的のページにリダイレクトします。
1 |
#!/usr/bin/perl
##### Character-code is euc-jp. Tab-size is 4 space character. #####
###############################################################################
## Redirect Jamp Script
###############################################################################
use strict; # restrict unsafe constructs
use warnings; # control optional warnings ( as /usr/bin/perl -w )
if( $ENV{'QUERY_STRING'} eq '' ){
print "Content-type: text/plain\n\n";
print "can't jump to page ....\n";
}else{
my $jamp = $ENV{'QUERY_STRING'};
$jamp =~ s/%3A/:/g;
$jamp =~ s/%2E/\./g;
$jamp =~ s/%2F/\//g;
chomp($jamp);
print "Location: ${jamp}\n\n";
}
###############################################################################
## End Of File (go0.cgi) ##
############################################################################### |
Aタグ リンククリック
CGIでAタグを出力して目的のページのリンクを表示します。
1 |
#!/usr/bin/perl
##### Character-code is euc-jp. Tab-size is 4 space character. #####
###############################################################################
## Redirect Jamp Script
###############################################################################
use strict; # restrict unsafe constructs
use warnings; # control optional warnings ( as /usr/bin/perl -w )
if( $ENV{'QUERY_STRING'} eq '' ){
print "Content-type: text/plain\n\n";
print "can't jump to page ....\n";
}else{
my $jamp = $ENV{'QUERY_STRING'};
$jamp =~ s/%3A/:/g;
$jamp =~ s/%2E/\./g;
$jamp =~ s/%2F/\//g;
$jamp =~ tr/<//;
$jamp =~ tr/>//;
print "Content-type: text/html;\n\n";
print "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN'>";
print "<html><head>";
print "<meta http-equiv='Content-Type' content='text/html'>";
print "<div style='text-align: center;'>Jamp to <a href='${jamp}'>${jamp}</a></div>";
print "</body></html>";
}
###############################################################################
## End Of File (go1.cgi) ##
############################################################################### |
Metaタグ Refresh
CGIでMetaタグを出力してRefresh機能でリダイレクトします。
1 |
#!/usr/bin/perl
##### Character-code is euc-jp. Tab-size is 4 space character. #####
###############################################################################
## Redirect Jamp Script
###############################################################################
use strict; # restrict unsafe constructs
use warnings; # control optional warnings ( as /usr/bin/perl -w )
if( $ENV{'QUERY_STRING'} eq '' ){
print "Content-type: text/plain\n\n";
print "can't jump to page ....\n";
}else{
my $jamp = $ENV{'QUERY_STRING'};
$jamp =~ s/%3A/:/g;
$jamp =~ s/%2E/\./g;
$jamp =~ s/%2F/\//g;
$jamp =~ tr/<//;
$jamp =~ tr/>//;
print "Content-type: text/html;\n\n";
print "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN'>";
print "<html><head>";
print "<meta http-equiv='Content-Type' content='text/html'>";
print "<meta http-equiv='Refresh' content='0; URL=${jamp}'>";
print "<div style='text-align: center;'>Jamp to <a href='${jamp}'>${jamp}</a></div>";
print "</body></html>";
}
###############################################################################
## End Of File (go2.cgi) ##
############################################################################### |
JavaScript location.href
CGIでJavaScriptを出力してlocation.hrefプロパティでリダイレクトします。
1 |
#!/usr/bin/perl
##### Character-code is euc-jp. Tab-size is 4 space character. #####
###############################################################################
## Redirect Jamp Script
###############################################################################
use strict; # restrict unsafe constructs
use warnings; # control optional warnings ( as /usr/bin/perl -w )
if( $ENV{'QUERY_STRING'} eq '' ){
print "Content-type: text/plain\n\n";
print "can't jump to page ....\n";
}else{
my $jamp = $ENV{'QUERY_STRING'};
$jamp =~ s/%3A/:/g;
$jamp =~ s/%2E/\./g;
$jamp =~ s/%2F/\//g;
$jamp =~ tr/<//;
$jamp =~ tr/>//;
print "Content-type: text/html;\n\n";
print "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN'>";
print "<html><head>";
print "<meta http-equiv='Content-Type' content='text/html'>";
print "<meta http-equiv='Content-Script-Type' content='text/javascript'>";
print "<script language='JavaScript'><!--\n";
print "location.href='${jamp}';";
print "\n//--></script>";
print "<div style='text-align: center;'>Jamp to <a href='${jamp}'>${jamp}</a></div>";
print "</body></html>";
}
###############################################################################
## End Of File (go3.cgi) ##
############################################################################### |
JavaScript location.assign
CGIでJavaScriptを出力してlocation.assign()メソッドでリダイレクトします。
1 |
#!/usr/bin/perl
##### Character-code is euc-jp. Tab-size is 4 space character. #####
###############################################################################
## Redirect Jamp Script
###############################################################################
use strict; # restrict unsafe constructs
use warnings; # control optional warnings ( as /usr/bin/perl -w )
if( $ENV{'QUERY_STRING'} eq '' ){
print "Content-type: text/plain\n\n";
print "can't jump to page ....\n";
}else{
my $jamp = $ENV{'QUERY_STRING'};
$jamp =~ s/%3A/:/g;
$jamp =~ s/%2E/\./g;
$jamp =~ s/%2F/\//g;
$jamp =~ tr/<//;
$jamp =~ tr/>//;
print "Content-type: text/html;\n\n";
print "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN'>";
print "<html><head>";
print "<meta http-equiv='Content-Type' content='text/html'>";
print "<meta http-equiv='Content-Script-Type' content='text/javascript'>";
print "<script language='JavaScript'><!--\n";
print "location.assign('${jamp}');";
print "\n//--></script>";
print "<div style='text-align: center;'>Jamp to <a href='${jamp}'>${jamp}</a></div>";
print "</body></html>";
}
###############################################################################
## End Of File (go4.cgi) ##
############################################################################### |
JavaScript location.replace
CGIでJavaScriptを出力してlocation.replace()メソッドでリダイレクトします。ブラウザの履歴エントリが置換されるため、「戻る」ボタン等で戻ることが出来なくなる。
1 |
#!/usr/bin/perl
##### Character-code is euc-jp. Tab-size is 4 space character. #####
###############################################################################
## Redirect Jamp Script
###############################################################################
use strict; # restrict unsafe constructs
use warnings; # control optional warnings ( as /usr/bin/perl -w )
if( $ENV{'QUERY_STRING'} eq '' ){
print "Content-type: text/plain\n\n";
print "can't jump to page ....\n";
}else{
my $jamp = $ENV{'QUERY_STRING'};
$jamp =~ s/%3A/:/g;
$jamp =~ s/%2E/\./g;
$jamp =~ s/%2F/\//g;
$jamp =~ tr/<//;
$jamp =~ tr/>//;
print "Content-type: text/html;\n\n";
print "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN'>";
print "<html><head>";
print "<meta http-equiv='Content-Type' content='text/html'>";
print "<meta http-equiv='Content-Script-Type' content='text/javascript'>";
print "<script language='JavaScript'><!--\n";
print "location.replace('${jamp}');";
print "\n//--></script>";
print "<div style='text-align: center;'>Jamp to <a href='${jamp}'>${jamp}</a></div>";
print "</body></html>";
}
###############################################################################
## End Of File (go5.cgi) ##
############################################################################### |
JS document.write() + Metaタグ
document.write() で「Refresh機能でリダイレクトするMetaタグ」を出力するJavaScriptをCGIで作成する。
HTML + JavaScript location
document.location.search で指定したURLのサーチ部(?以降)を取得して、location.href プロパティでリダイレクトします。
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML> <HEAD> <TITLE>page jump</TITLE> <SCRIPT LANGUAGE="JavaScript"> var strRef=document.location.search; var strUri=strRef.substr(1, strRef.length-1); location.href=strUri; </SCRIPT> </HEAD> <BODY>can't jump to page ....</BODY> </HTML> |
HTML + JavaScript + Metaタグ
document.location.search で指定したURLのサーチ部(?以降)を取得して、document.write で「Refresh機能でリダイレクトするMetaタグ」を出力してリダイレクトします。
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML> <HEAD> <TITLE>page jump</TITLE> <SCRIPT LANGUAGE="JavaScript"> var strRef=document.location.search; var strUri=strRef.substr(1, strRef.length-1); var strTag='<meta http-equiv="Refresh" content="0; URL=' + strUri + '">'; document.write(strTag); </SCRIPT> </HEAD> <BODY>can't jump to page ....</BODY> </HTML> |
最終更新時間:2008年11月19日 21時51分00秒 指摘や意見などあればSandBoxのBBSへ。