Exemplo n.º 1
0
        private static SendUrlRequestResponse CanLoadResource(SendUrlRequestParameters arg)
        {
            if (arg.UrlRequest.ResourceType == ResourceType.Xhr)
            {
                Console.WriteLine("Suppress ajax call - " + arg.UrlRequest.Url);
                return(SendUrlRequestResponse.Cancel());
            }

            return(SendUrlRequestResponse.Continue());
        }
Exemplo n.º 2
0
        public static SendUrlRequestResponse OnSendUrlRequest(SendUrlRequestParameters parameters)
        {
            // If navigate to teamdev.com, then change URL to google.com.
            if (parameters.UrlRequest.Url == "https://www.teamdev.com/")
            {
                Console.WriteLine("Redirecting to https://www.google.com/");
                return(SendUrlRequestResponse.Override("https://www.google.com"));
            }

            return(SendUrlRequestResponse.Continue());
        }
Exemplo n.º 3
0
        private static SendUrlRequestResponse OnSendUrlRequest(SendUrlRequestParameters arg)
        {
            // Here, we check the URL request and decide if we want to intercept a response for it.
            // For instance, we can check the resource type. This works for AJAX requests.
            // We can also check the arg.UrlRequest.Url to determine if this is a URL we need.
            if (arg.UrlRequest.ResourceType == ResourceType.Xhr)
            {
                AjaxRequests[arg.UrlRequest.Url] = new HttpRequest(arg.UrlRequest.Url, arg.UrlRequest.Method);
            }

            return(SendUrlRequestResponse.Continue());
        }