-
-
Notifications
You must be signed in to change notification settings - Fork 197
IBrowserSettings
David Ortner edited this page May 30, 2024
·
6 revisions
IBrowserSettings represents the settings of the browser.
interface IBrowserSettings
import { Browser } from "happy-dom";
const browser = new Browser();
browser.settings.navigator.userAgent =
"Mozilla/5.0 (X11; Linux x64) AppleWebKit/537.36 (KHTML, like Gecko) HappyDOM/2.0.0";
Property | Type | Description |
---|---|---|
disableJavaScriptEvaluation | boolean | Disables JavaScript evaluation. |
disableJavaScriptFileLoading | boolean | Disables JavaScript file loading. |
disableCSSFileLoading | boolean | Disables CSS file loading. |
disableComputedStyleRendering | boolean | Disables computed style rendering. |
handleDisabledFileLoadingAsSuccess | boolean | Set to "true" to trigger a load event instead of an error event when file loading is disabled. |
errorCapture | BrowserErrorCaptureEnum | Error capturing policy. |
navigation.disableMainFrameNavigation | boolean | Disables navigation to other pages in the main frame or a page. |
navigation.disableChildFrameNavigation | boolean | Disables navigation to other pages in child frames (such as iframes). |
navigation.disableChildPageNavigation | boolean | Disables navigation to other pages in child pages (such as popup windows). |
navigation.disableFallbackToSetURL | boolean | Disables the fallback to setting the URL when navigating to a page is disabled or when inside a detached browser frame. |
navigation.crossOriginPolicy | BrowserNavigationCrossOriginPolicyEnum | Sets the policy for cross-origin navigation. |
navigator.userAgent | string | User agent. |
navigator.maxTouchPoints | number | Max touch points. |
timer.maxTimeout | number | Sets the maximum time a timeout is allowed to have. This can improve load times if the environment has long running timers. Set to -1 to disable (disabled by default). |
timer.maxIntervalTime | number | Sets the maximum time an interval is allowed to have. This can improve load times if the environment has long running intervals. Set to -1 to disable (disabled by default). |
timer.maxIntervalIterations | number | Sets the maximum number of interval iterations. This can unblock environments from completing loading. Set to -1 to disable (disabled by default). |
device.prefersColorScheme | string | Prefers color scheme. |
device.mediaType | string | Media type. |