2017-01-20 9 views
1

Safari、Chrome、Operaでは動作しますが、Firefoxでは動作しない共有ボタンがあります。 Firefoxで新しい空のウィンドウを開くのはなぜでしょうか?Firefoxでこれらの共有ボタンが機能しないのはなぜですか?

<script type="text/javascript"> 
function fbCurrentPage() 
{window.open("https://www.facebook.com/sharer/sharer.php?u="+escape(window.location.href)+"&t="+document.title, '', 
'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');} 
function twitterCurrentPage() 
{window.open("https://twitter.com/share?u="+escape(window.location.href)+"&t="+document.title, '', 
'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');} 
function gplusCurrentPage() 
{window.open("https://plus.google.com/share?url="+escape(window.location.href)+"&t="+document.title, '', 
'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=605,width=400');} 
</script> 

<div class="social"> 
<a href="javascript:fbCurrentPage()" class="facebook">Facebook</a> 
<a href="javascript:twitterCurrentPage()" class="twitter">Twitter</a> 
<a href="javascript:gplusCurrentPage()" class="gplus">Google+</a> 
</div> 

答えて

1

Firefoxはtarget="_blank"属性で混乱します。 Firefoxはabout:blankというURLの新しいタブを開き、次のいずれかの機能を実行しようとします。 fbCurrentPageが新しく開かれたタブに表示されますが、この機能は「空の」ドキュメントには存在しません。

リンクからtarget属性を削除するだけです。関数は新しいウィンドウを開くwindow.openを使用するので、不要です。

サイドノートでは、コードはHTML 5仕様では無効です。リンク内にボタンがあります。 aの要素はspecには含まれません。interactive content

+0

ありがとうございます!それが今、私は上記のビットを更新しました。 – Ash

関連する問題