Skip to Content
0

Browser refreshing issue With SAP UI5 Router

Jul 04, 2017 at 09:04 AM

105

avatar image

Hello,

I have a issue with refreshing the page which is loaded using SAPUI5 router.

For example : below is the URI which am accessing.

Host:Port//sap/bc/ui5_ui5/sap/zDemo/index.html?sap-ui-language=EN#/Test1?SrNum=0001

Here in the above case if i change the number to 0002 in the browser URL and pressed enter, then if i checked in network tab of developer tools. Only it is loading the service calls and updating the data in the UI . But my requirement is to load the complete application including view manifest and other files as well. ( Like if you press F5 or Ctrl+F5).

if i reload the application with Ctrl+F5 it is working as expected.

Could you please suggest me how can i overcome with this issue.

Best Regards,

Bhaskar.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

avatar image
Former Member Jul 06, 2017 at 09:56 AM
0

Hi,

Try the following code: window.location.reload()

regards

GB

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Vaibhav,

in which event we can reload the page.

if i add in any one of the hook method then whenever we are navigating to this view it will refresh the page , and then again hook methods will trigger and application will refresh. This is like infinite loop.

So is there any other event that we can know on click of enter in browser URL we can trigger.

Even i checked for window.onunload event , this is also not triggered. :( :(

Best Regards,

Bhaskar.

0
Former Member

you can call this command in router matched method but before you do it you need to have a global check variable say

g_check.

in onInit make g_ckeck = false;

in routeMatched method make a validation first

if(g_check){

window.location.reload();

}else{

g_check = true;

}

regards

GB

0

Actually, i can navigate to that page multiple times so I can't directly write a global variable check since if I navigate to that page second time it will reload the application again.

But I want to reload only in case of when user press Enter in Browser URL after changing the value in the route.

Best Regards,

Bhaskar.

0