I have a lightning component which handles a event and performs subsequent dml operations. Once this is done, a toast message is displayed (success/ error etc.) I want to refresh the entire browser window after this. I tried force:refreshView, but it just refreshes the component.

Any help? :)


You can use standard JS way -


Please note you have to make a property call from window object obligately (not just location.reload()) because Lightning LockerService treats the global namespace differently and the window object there is a special wrapper around original one.

Have tested it inside one of my Lightning components under Chrome and IE 11 - it works.

As an alternative (but not recommended), you can try the old Lightning way with refresh event:


documentation is here


But from my experience, it works smoothly not everywhere,
e.g. I encountered the next issue in one of the places:

Uncaught Action failed: one:recordHomeFlexipage$controller$refresh 
[Cannot read property 'Qi' of null] 

and there is no documentation entries for this event on API v43 and v44.

| improve this answer | |

You could redirect it on success as described here:

navigateToMyComponent : function(component, event, helper) {
    var evt = $A.get("e.force:navigateToComponent");
        componentDef : "c:myComponent",
        componentAttributes: {
            contactName : component.get("v.contact.Name")
| improve this answer | |
  • Hello, I tried this. Thanks for your comment btw. I navigated to the sObject record. However it doesnt refresh the page and hence I cannot see the updated case record post the dml operation. I still have to manually refresh the browser page. :) – Kaustubh Labhe Nov 8 '17 at 11:56
  • The referred link does not work anymore. – Sander de Jong Mar 4 at 7:55

You can use location.reload() in the lightning web component to refresh the page.

| improve this answer | |

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.