-1

i made some changes on a JavaScript which is hosted in my sharepoint. But the changes don't work for All users except System admin. Any help?

Here's the code:

Change.Track = function (FileName, verM, verMin, ListName, urlSite) {
        var fileMaj = "", ficMin = "", verM, verM;
        var data = Get.FileVersions(FileName);

        for (var i = 0; i < data.length; i++) {
            if (data[i].version.split(".")[1] === verMin || data[i].version.startsWith("@")) {
                fileMin = data[i].url
                verMin = data[i].version;
            }
            else if (data[i].version === verMaj || data[i].version === "0.1") {
                fileMaj = data[i].url
                verMaj = data[i].version;
            }
        }

        var title = "TrackChanges"
        var url = Get.config.urlSiteWeb.toString() +
        "/_Layouts/TrackChange/changes.aspx?fileMaj=" +
        fileMaj + "&fileMin=" + fileMin + "&listName=" + ListName + "&urlSite=" +
        urlSite + "/" + "&verMaj=" + verMaj + "&verMin=" + verMin;


        window.open(url, "_blank");

        // var d = Get.AfficheModal(encodeURIComponent(url), title);
        // var f = d.get_frameElement();
        //f.src = url;
    };

I only add that line to the script so the page can open in a new windows

window.open(url, "_blank");

Then i commented theses lines

    // var d = Get.AfficheModal(encodeURIComponent(url), title);
    // var f = d.get_frameElement();
    //f.src = url;

its work only when am logged as admin. All the users have access to the library where the script is hosted

  • What happens exatly? The new version of the script is not loaded? There's a JavaScript error? The page "changes.aspx" (a custom page of your own?) raises an error ? – Evariste Jan 30 '17 at 16:37
  • The new line that i've added will allow the page to open in a new window. but its work only when am logged in as an admin not with a normal user. it doesn't open in a new windows for a normal user. – djgibbs Jan 30 '17 at 16:50
1

Where's your JavaScript file hosted?
If it's in a SharePoint document library (like "Site Assets" or else), it may be that the file is not published/approved.
Check whether the doc lib has versioning enabled, and publish the file as a major version (+ approve it if needed).

  • Hi thank for your answer. The script is hosted in Style in Library/scripts/ on my Sharepoint Website. A major version of the script is published. – djgibbs Jan 30 '17 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.