Skip to content

v0.2.0 — Anti-redirect / URL blocking

Choose a tag to compare

@enowdev enowdev released this 23 Jul 19:07
· 1 commit to main since this release

Adds anti-redirect / URL blocking — a feature not present in upstream CloakBrowser.

Cancel navigations/requests to URL glob patterns via CDP request interception. Prevents a page from auto-redirecting you to another site.

let (mut browser, mut handler) = launch(LaunchOptions {
    block_urls: vec!["*://ads.example.com/*".into(), "*doubleclick*".into()],
    ..Default::default()
}).await?;
let page = browser.new_page("about:blank").await?;
let _guard = block_navigations(&page, ["*://ads.example.com/*"]).await?;

Verified live: a JS redirect to a blocked URL never reaches the target. 88 tests pass.