!!!概要
{{category ScrapCode,Parl,JavaScript,WebBrowser,nolink}}ウェブページで別のページに飛ばす、リダイレクトの方法とそのときのリファラーの値。
,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 / サーバーの仕様に関する情報
**http://isweb.www.infoseek.co.jp/info/iw_spec.html#cgi
!!BIGLOBE 個人ホームページ の cgiの呼び出し制限
*BIGLOBE - CGIの利用について
**http://homepage.biglobe.ne.jp/manual/cgi/index.html
!!!HTTP Location ヘッダ
CGIでHTTPのLocationヘッダを出力して目的のページにリダイレクトします。
{{code Perl,4,
#!/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タグを出力して目的のページのリンクを表示します。
{{code Perl,4,
#!/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 "";
print "
";
print "";
print "";
print "";
}
###############################################################################
## End Of File (go1.cgi) ##
###############################################################################
}}
!!!Metaタグ Refresh
CGIでMetaタグを出力してRefresh機能でリダイレクトします。
{{code Perl,4,
#!/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 "";
print "";
print "";
print "";
print "";
print "";
}
###############################################################################
## End Of File (go2.cgi) ##
###############################################################################
}}
!!!JavaScript location.href
CGIでJavaScriptを出力してlocation.hrefプロパティでリダイレクトします。
{{code Perl,4,
#!/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 "";
print "";
print "";
print "";
print "";
print "";
print "";
}
###############################################################################
## End Of File (go3.cgi) ##
###############################################################################
}}
!!!JavaScript location.assign
CGIでJavaScriptを出力してlocation.assign()メソッドでリダイレクトします。
{{code Perl,4,
#!/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 "";
print "";
print "";
print "";
print "";
print "";
print "";
}
###############################################################################
## End Of File (go4.cgi) ##
###############################################################################
}}
!!!JavaScript location.replace
CGIでJavaScriptを出力してlocation.replace()メソッドでリダイレクトします。ブラウザの履歴エントリが置換されるため、「戻る」ボタン等で戻ることが出来なくなる。
{{code Perl,4,
#!/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 "";
print "";
print "";
print "";
print "";
print "";
print "";
}
###############################################################################
## End Of File (go5.cgi) ##
###############################################################################
}}
!!!JS document.write() + Metaタグ
document.write() で「Refresh機能でリダイレクトするMetaタグ」を出力するJavaScriptをCGIで作成する。
!!!HTML + JavaScript location
document.location.search で指定したURLのサーチ部(?以降)を取得して、location.href プロパティでリダイレクトします。
{{code HTML,4,
page jump
can't jump to page ....
}}
!!!HTML + JavaScript + Metaタグ
document.location.search で指定したURLのサーチ部(?以降)を取得して、document.write で「Refresh機能でリダイレクトするMetaタグ」を出力してリダイレクトします。
{{code HTML,4,
page jump
can't jump to page ....
}}