SharePointサイト:働いていないjavascipt
-
29-09-2020 - |
質問
SharePointサイトを持っています。JavaScriptは、私のホームページのみで機能しているようです。他のページにNaviagateが発生した場合、JavaScriptは実行されません。私はChrome Browserの動作を最もよく観察しました。
解決 2
ChromeブラウザからSharePoint 2010を表示するときは、断続的にページがロードされますが、JavaScriptの初期化関数の呼び出しに失敗します。ページを部分的にのみ機能されます。
閉じるボディタグの直前のこのコードをマスターページファイルの下部に置きます。 PS:> http://mosswell.blogspot.com/2013/06/SharePoint-2010-and-chrome-javascript.html
<script type="text/javascript">
/*****************
*
* Code to handle the SharePoint / Chome bug
*
*****************/
function chromeNudge() {
/// <summary>
/// If SharePoints body onload handler has not fired yet
/// this function calls it manually
/// </summary>
if (!_spBodyOnLoadCalled) {
if (window.console) {
window.console.log('Chrome Bug: _spBodyOnLoadWrapper did not fire, calling manually.');
}
_spBodyOnLoadWrapper();
}
}
function chromeNudgeDelay() {
/// <summary>
/// If the current browser is Chrome, set a Timeout
/// to call chromeNudge to at that time evaluate
/// whether the onload wrapper needs a "nudge"
/// </summary>
if (navigator && navigator.userAgent && /chrome/.test(navigator.userAgent.toLowerCase())) {
setTimeout(chromeNudge, 250);
}
}
// call chromeNudgeDelay after MS Ajax init event (aka body load)
Sys.Application.add_init(chromeNudgeDelay);
.
他のヒント
マスターページの実際のスクリプトタグの場合は、マスターページにシンタックスエラーがあります。これは、ページ上のJavaScriptのすべての残りのすべてを殺します。
あなたはドットとJavaScriptであると大文字と小文字が区別されているので、 'document.getElementsByName'が 'document.etelementsbyname'
を必要とします。var logoImg = document.getElementsByName(...)
.
Movesitetle()は、その最初のインラインスクリプトが機能していた場合は利用できる機能であると仮定していますが、それがグローバルに利用可能であることを確認する必要があります。
JavaScriptが機能しているかどうかを確認するには、次の
を実行してください。1)Webページにスクリプトエディタを挿入します。 2)エディタ内で次のコードを入力します。
警告(「JavaScriptは働いています」)。所属していません sharepoint.stackexchange