ホームページを作る立場の人には参考になるだろうと思い、残しておく。
お気に入りに追加ボタンがIE用では動くのだがfirefoxでは動かずなかなか苦労していた。
<p>
<script type="text/javascript">
<!--
if(navigator.userAgent.indexOf("MSIE") > -1){ //Internet Explorer
document.write('<!-'+'-[if IE]>');
document.write('<input type="button" value="お気に入りに追加"');
document.write(' onclick="window.external.AddFavorite(\'サイトURL\',\'サイト名\')">');
document.write('<![endif]-'+'->');
}
else if(navigator.userAgent.indexOf("Firefox") > -1){ //Firefox
document.write('<input type="button" value="ブックマークに追加"');
document.write(' onclick="window.sidebar.addPanel(\'サイト名\',\'サイトURL\',\'\');">');
}
else if(navigator.userAgent.indexOf("Opera") > -1){ //Opera
document.write('<a href="サイトURL" rel="sidebar" title="サイト名">ブックマークに追加</a>');
}
else { //該当なし
void(0); //何もしない
}
//-->
</script>
</p>
このPタグをボタンを表示させたい場所にはりつける(headじゃないよ)
⇒赤は自分のサイトに合わせて変える
⇒青は変えても変えなくても良い
※ \や"など絶対にいじらないこと。
お気に入りに追加ボタンがIE用では動くのだがfirefoxでは動かずなかなか苦労していた。
<p>
<script type="text/javascript">
<!--
if(navigator.userAgent.indexOf("MSIE") > -1){ //Internet Explorer
document.write('<!-'+'-[if IE]>');
document.write('<input type="button" value="お気に入りに追加"');
document.write(' onclick="window.external.AddFavorite(\'サイトURL\',\'サイト名\')">');
document.write('<![endif]-'+'->');
}
else if(navigator.userAgent.indexOf("Firefox") > -1){ //Firefox
document.write('<input type="button" value="ブックマークに追加"');
document.write(' onclick="window.sidebar.addPanel(\'サイト名\',\'サイトURL\',\'\');">');
}
else if(navigator.userAgent.indexOf("Opera") > -1){ //Opera
document.write('<a href="サイトURL" rel="sidebar" title="サイト名">ブックマークに追加</a>');
}
else { //該当なし
void(0); //何もしない
}
//-->
</script>
</p>
このPタグをボタンを表示させたい場所にはりつける(headじゃないよ)
⇒赤は自分のサイトに合わせて変える
⇒青は変えても変えなくても良い
※ \や"など絶対にいじらないこと。