Listen to the URL navigation process

When Griver AppContainer loads a URL, it uses WebView to load the page. If you want to open some URLs in your browser, you can intercept the URL navigation process of Griver by implementing the GriverUrlNavigationEvent interface. Each time when Griver loads a URL, it sends out the GriverUrlNavigationEvent interface and you can intercept it.

copy
public interface GriverUrlNavigationEvent extends GriverEvent {

    /**
     * This method will be called when Griver opens a new page through URL.
     *
     * @param page The page that will open
     * @param url  The URL that will open
     * @return true will open the URL.
     */
    
    boolean allowLoadUrl(Page page, String url);
    
    /**
     * This method will be called when Griver opens a new page through URL.
     *
     * @param page The page that will open
     * @param url  The URL that will open
     * @return true will intercept the URL without opening it, and false will continue
     * to open the URL.
     */
    
    boolean onStartUrlNavigation(Page page, String url);
     
}

Note: The allowLoadUrl method has a higher priority. When the method returns true, the URL is opened. When the method returns false, the interception logic of the onStartUrlNavigation method is executed. If the onStartUrlNavigation method returns true, the URL is intercepted.