JavaScriptを使って出来ないことはないですけど、どのみち全頁にJavaScriptを埋め込むための書き換えが必要ですし、
JavaScript offだと機能しないのと、また、フレーム非対応ブラウザへのアクセシビリティとしても、
サイトトップまたは、メニューページへのリンクは全頁に付けておくべきだと思います。
各頁に埋め込むJavaScript 外部ファイルにしておくのが便利
if( window.parent.frames.length < 2){
location.href= "http://site/index.html?"+location.href;
// site名適宜 frameset用ファイルのurlを絶対指定で入れる
//(ディレクトリー階層の差を吸収のため)
}
トップのframeset用ファイルに埋め込むJavaScript
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<html lang="ja">
<head>
<script type="text/javascript">
window.onload = function(){
xb = location.search.substring(1,999);
if(xb ){
if( xb.indexOf("http://site/") == 0){
// 自サイト内への指定かチェック
self.frames["H2"].location.href = xb;
// frame名は、目的ページを表示したい方のframe名を入れる
}
}
}
</script>
</head>
<frameset cols="40%,*" border="1" frameborder="1">
<frame src="menu.html" name="H1" scrolling="auto" noresize>
<frame src="page.html" name="H2" scrolling="auto" noresize>
<noframe>
<body><a href="menu.html">site menu</a>
</body></noframe>
</frameset>
</html>