2016-10-11 1 views
4

Google DFPによって提供される次の標準コードがあります。それが、これはGoogleの自身の標準DFPスクリプトですので、私はこれは本当に奇妙見つけるdocument.writeGoogle DFPが提供するスクリプトは、パーサーブロッキングのクロスオリジンスクリプトとしてリストされています

<script> 
(function() { 
    var useSSL = 'https:' == document.location.protocol; 
    var src = (useSSL ? 'https:' : 'http:') + 
    '//www.googletagservices.com/tag/js/gpt.js'; 
    document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>'); 
})(); 
</script> 

を使用して実装されているため、残念ながらそれはパーサブロッキング、クロスオリジン・スクリプトとしてリストされています。私は使用しなければならない更新されたバージョンはありますか?

+1

を私は<スクリプトSRC = "https://www.googletagservices.com/tag/js/gpt.js">にスクリプトを変更しはまだ問題ではありません解決されました。 gpt.jsはさらに2つのdocument.writeを使用して2つのスクリプトを作成します。私のURLはhttps://dnd-checker.talentpark.net/です。誰かがこれに対する解決策を見つけることができます。 –

答えて

1

あなたがこれを使用することができます:

(function() { 
    var gads = document.createElement('script'); 
    gads.async = true; 
    gads.type = 'text/javascript'; 
    var useSSL = 'https:' === document.location.protocol; 
    gads.src = (useSSL ? 'https:' : 'http:') + 
     '//www.googletagservices.com/tag/js/gpt.js'; 
    var node = document.getElementsByTagName('script')[0]; 
    node.parentNode.insertBefore(gads, node); 
}()); 
関連する問題