SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Bit stumped on this one, wonder if anyone can help?

I've created some JavaScript which is stored in the Style Library and referenced by the JSLink property of a site column. When I navigate to a document library that includes the site column in its default view, the JSLink code does not appear to fire (tested using the line that writes to the console).

When I refresh the page however, the JSLink code fires and the image link is rendered for each item in the view. Why doesn't this code fire on the initial page load, but only on page refreshes?

(function () {
var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.Fields = {
    'SiteColumnInternalName': {
        'View': function (ctx) {
    // write to the console so we know whether or not the render code has run
    if (console != undefined) console.log("Render code hit");
            return "<a href='" + ctx.HttpRoot + "/_layouts/somefolder/somepage.aspx?List=" +
                    ctx.listName.replace('{', '').replace('}', '') + "&ID=" + ctx.CurrentItem.ID + "'>" +
                        "<img src='" + ctx.HttpRoot + "/Style%20Library/img/someimage.gif'/>" +
share|improve this question

Check out how this JavaScript is run with the minimal download option enabled.

Take the code sample and replace the address at the bottom with where you placed the JSlink file and give it a spin.

share|improve this answer

I found the answer in the following link:

MS added an SPWeb scoped feature called 'Minimal Download Strategy' to SharePoint 2013 which appears to break JSLink rendering (except for on page refreshes). Disabling the feature fixed the JSLink rendering!

share|improve this answer
just to let you know, I am successfully using JSLink on sites with Minimal Download Strategy activated. – Robert Lindgren Jun 10 '13 at 13:16
Perhaps I'm missing a SP update on my dev server... Were you using JSLink successfully on a Field or for something else (i.e. list view/web part)? Thanks – SPQuestion Jun 10 '13 at 14:19
Both on a field and in an XSLT list view webpart :) – Robert Lindgren Jun 10 '13 at 14:20
Did you use RegisterModuleInit()?… – SPQuestion Jun 10 '13 at 20:49
Ok, thanks for your feedback - hopefully I'll get a chance to test both the _layouts approach and the RegisterModuleInit() approach and see if either or both work for me (with MDS enabled), as this would be preferable to disabling the feature. Thanks – SPQuestion Jun 12 '13 at 9:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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