Skip to main content
  • From Base URL String
  • From The Current Page's URL
  • From Anchor Element
export declare function resolveUrl(input: {
  url: string;
  baseUrl: string;
}): Promise<string>;
Converts any URL source to an absolute, properly encoded URL by combining a relative URL with a base URL string.

Examples

import { resolveUrl } from '@intuned/browser';
export default async function handler(params, page, context){
await page.goto("https://example.com");

// Using explicit base URL
const absoluteUrl = await resolveUrl({
  url: "/api/users",
  baseUrl: "https://example.com"
});
// Returns: "https://example.com/api/users"
}

Arguments

input
Object
required
Configuration object with different properties based on the overload

Returns: Promise<string>

Promise that resolves to the absolute, properly encoded URL string