문제

SharePoint 사이트가 있습니다.JavaScripts는 내 홈 페이지에서만 작동하는 것 같습니다.다른 페이지로나 Naviagate를 사용하면 JavaScript가 실행되지 않습니다.나는 크롬 브라우저에서의 행동을 가장 많이 관찰했다.

도움이 되었습니까?

해결책 2

Chrome 브라우저에서 SharePoint 2010을 볼 때 간헐적으로 페이지가로드되지만 JavaScript 초기화 함수를 호출하지 못하면 페이지를 부분적으로 만 기능합니다.

이 코드를 닫는 바디 태그 직전에 마스터 페이지 파일의 맨 아래에 놓습니다. 추신 : 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를 죽일 수 있습니다.

DOT가 누락되어 JavaScript는 대소 문자를 구분하므로 'DocumentGetElementsByName'이 아닌 'DocumentGetElementsByName'이 필요합니다.

var logoImg = document.getElementsByName(...)
.

나는 또한 movesIteTitle ()이 첫 번째 인라인 스크립트가 작동하는 경우 사용할 수있는 함수이지만 전 세계적으로 사용할 수 있는지 확인해야합니다.

JavaScript가 작동하는지 여부를 확인하거나 다음을 수행하지 않는지 확인하십시오

1) 웹 페이지에 스크립트 편집기를 삽입하십시오. 2) 편집기 내에 다음 코드를 입력하십시오.

경고 ( "JavaScript가 작동합니다");

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top