Page redirect / refresh using ExtJS
Solution 1
location.href will do, unless otherwise if they are on different domain.
Solution 2
These three methods will do the job (Source- MediaCollege.com):
<input type="button" value="Reload Page" onClick="window.location.reload()">
<input type="button" value="Reload Page" onClick="history.go(0)">
<input type="button" value="Reload Page" onClick="window.location.href=window.location.href">
If you're just looking for code to stick directly in a script, try:
window.location.reload()
history.go(0)
window.location.href=window.location.href
Solution 3
Add this to your clickable element:
onclick = "location.href='anotherpage.jsp'"
For example:
< img src="blablabla.png" onclick="location.href='anotherpage.jsp'" >
Abdel Raoof Olakara
A Web enthusiast, who loves working on .NET and JavaScript. Over 14 years of experience with Web technologies, solution architecture and consulting.
Updated on July 06, 2022Comments
-
Abdel Raoof Olakara almost 2 years
My Web application makes use of Ext JS & Java web technology. Due to the size and complexity of the application, I need to do a complete refresh of the page (load a different page) when user select some menu from the menu bar. What is the best what to redirect to the required page?
For example, In my main menu, I have two menu Stock & Location. These two menu will take the user to different JSP files (stockmgt.jsp & locmgt.jsp) with new layouts,menu items etc.
One possibility is to use location.href in the button or menu handler. But if I do this, will I retain the session variables, and other parameters?
What are the best practices in doing these kind of redirect or page refresh?
Thanks in advance for the ideas, comment and suggestions.