window.top.open(url, '_self')
.
Use this function to override the default navigation behavior and integrate with your application’s routing system.
This is particularly useful for Single Page Applications (SPAs) that use client-side routing libraries like React Router, Vue Router, or Angular Router.
Parameters
A navigation function that accepts a URL string parameter. Pass
null
to restore default behavior.Usage Examples
Basic Implementation
React Router Integration
React Router v6+ (Recommended)
React Router v5 (Legacy)
Vue Router Integration
Angular Router Integration
Next.js Integration
TanStack Router Integration
Notes
- The custom navigation function receives the target URL as a string parameter
- Ensure your navigation function handles both relative and absolute URLs appropriately
- Call
setCustomNavigate(null)
to revert to default page reload behavior