We are using Community Builder to create pages in a Napili based community. This allows us to use less code and more declarative page maintenance. We've noticed that using regular links clicked by users navigates very quickly between these pages e.g. using a tab navigation bar. It appears to do some kind of partial page refresh.

We also need to programatically navigate after an Apex save. The only way we know to do this is to change window.location but this navigation method is much slower (3-5 times slower) because it does a full page refresh instead of the fast partial refresh described above. Of course we want all our navigations to be fast.

Does anyone know of another technique to navigate (using javascript) using the fast Napili mechanism?

I've already tried:

  • a hidden link and using javascript to click the link (same full page refresh)
  • firing a navigateToURL event (only works on S1)

The hidden link idea is strange. If I make it visible and click it, the navigation is fast but if javascript .click() is used, the navigation is slow.

Any suggestions would be much appreciated and useful for all Napili developers in future.

1 Answer 1


The entire Napili is based on Lightning Component Framework and all the events available on SF1 is also available inside the Napili template .Its just not well documented I believe .

Here is a small code to help you with navigation inside Napili

<ui:button aura:id="button" buttonTitle="Contact Support" label="Contact Support" press="{!c.navigate}" class="uiButton forceCommunityAskCommunity"/>

Here is a small JS controller with event firing


 navigate : function(component, event, helper) {

    //Find the text value of the component with aura:id set to "address"
    var address = component.get("/url");
    var urlEvent = $A.get("e.force:navigateToURL");
      "url": address,
      "isredirect" :false

Also since its lightning based ,you can always call server side aura enabled method and inside the response returned you can perform client side interactions

  • Thanks Mohith. I tried your code and it does perform navigation but it does so by opening a new browser tab. This means that there's no way to know if it's able to use the fast navigation that we see from users clicking links. Does anyone know how to use this event and keep it in the same tab? Commented Apr 1, 2016 at 22:17
  • @SteveBuikhuizen Do you have href with target="_blank" .Also try playing with isredirect switching between true and false .May be with true it overrides current window . Commented Apr 1, 2016 at 22:35
  • Thanks. I tried both these suggestions but no change in behaviour. I'm curious about your suggestion of client interactions in apex code/responses. Is that documented somewhere? Commented Apr 1, 2016 at 22:40
  • Alright so i figured out why it opens in new tab .You have to keep the URL relative to open in same tab here .Like may be just use relative URLS like /s/pagename Commented Apr 1, 2016 at 22:42
  • 1
    THAT WORKED! Mohith you are a legend. Thank you. The magic combination is using the code above with relative urls and then you get the fast navigation. Commented Apr 1, 2016 at 22:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .