🌐 Browser Object Model (BOM)
Last Updated: 26th October 2025
- BOM (Browser Object Model) allows JavaScript to interact with the browser itself — not just the webpage (DOM).
- It provides access to browser features like window, screen, location, history, navigator, and alert dialogs.
Hinglish Tip 🗣: DOM webpage ke elements ko handle karta hai, BOM browser ke features (jaise URL, history, alert box) ko control karta hai.
- The
windowobject is the global object in the browser. - Every global variable, function, or object automatically becomes a property of
window.
console.log(window);
We Have already cover basic
windowmethodsalert(),confirm(),prompt()in Basic BOM
BOM vs DOM
BOM allows you to interact with the browser, while DOM allows you to interact with the webpage.
// Window methods
window.alert("Hello from Window!");
console.log(window.innerWidth); // browser window width
// Document methods
document.write("Hello from Document!");
console.log(document.title); // page title
Hinglish Tip 🗣: BOM browser ke control karta hai, DOM webpage ke elements ko handle karta hai.