Url

Pre-Navigation Storage Actions

Methods for attaching browser storage operations (cookies, localStorage, sessionStorage, IndexedDB) that execute automatically before the browser navigates to the URL.

Methods for attaching browser storage operations (cookies, localStorage, sessionStorage, IndexedDB) that execute automatically before the browser navigates to the URL.

WithStorageType begins a storage action configuration - set the type (cookie, localStorage, sessionStorage, indexedDb, cache). WithStorageKey sets the key for the storage item. WithStorageData sets the value to write for set operations. WithStoragePath and WithStorageDomain restrict cookie scope. WithStorageStoreName sets the IndexedDB store name. WithDeleteAcrossOrigins controls whether delete operations cross origin boundaries. WithUserDefined stores arbitrary metadata for GPAL-internal filtering. Multiple storage actions can be chained on a single GPALUrl.

Examples

GPAL Fluent: High-level fluent C# API

//Storage actions on a GPALUrl execute immediately before the navigation - GPAL runs the storage operation, then navigates to the URL. This is the clean way to set up browser state before visiting a page.

// Clear cookies before navigating var cleanUrl = GPAL.Url .ForUrl("https://example.com") .WithStorageType(WebsiteStorageType.cookie) .WithDeleteAcrossOrigins(true); GPAL.Browser.GoTo(cleanUrl); // Set a localStorage value before navigating var themedUrl = GPAL.Url .ForUrl("https://app.example.com") .WithStorageType(WebsiteStorageType.localStorage) .WithStorageKey("theme") .WithStorageData("dark"); GPAL.Browser.GoTo(themedUrl);