Docsity

Advanced Web Development: Understanding the Browser Object Model (BOM), Slides of Fundamentals of E-Commerce

Partial preview of the text

Download Advanced Web Development: Understanding the Browser Object Model (BOM) and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

CSCI 3110 Advanced Topics in Web Development

THE BROWSER OBJECT

MODEL (BOM)

BOM vs. DOM

Web browser "controlled" through BOM. Web page controlled through DOM. Docsity.com

BOM Object Hierarchy

window navigator frames[] location history document screen Root of the Document Object Model

JavaScript Window Object

Assumed unless another object specifically named.

Programmer-defined functions, variables, etc.

attached to window by default.

Window Object Reference:

http://www.javascriptkit.com/jsref/window.shtml Docsity.com

Opening a new browser window

window.open (p1, [p2, p3, p4])

p1: URL p2: target. Blank (or new name) opens new window. Existing window or frame, opened there. http://einstein.etsu.edu/~pittares/CSCI3110/examples/7-5.htm p3: controls window attributes using attribute/value pairs in a single string. http://einstein.etsu.edu/~pittares/CSCI3110/examples/7-6.htm p4: replace current page in browsing history (true/false)

Setting timeouts

setTimeout(p1, p2)

p1: string specifying function or a function definition p2: milliseconds until p1 is executed http://einstein.etsu.edu/~pittares/CSCI3110/examples/7-7.htm Returns timeoutID http://einstein.etsu.edu/~pittares/CSCI3110/examples/7-8.htm clearTimeout(timeoutID) http://einstein.etsu.edu/~pittares/CSCI3110/examples/7-9.htm Docsity.com

Browser dialogs

Modal:

alert confirm—returns true or false Prompt—returns user input

Non-modal:

print find http://einstein.etsu.edu/~pittares/CSCI3110/examples/7-10.htm

Window.navigator

Browser detection and information

http://www.javascriptkit.com/jsref/navigator.shtml Textbook page 126 Docsity.com

Window.screen

Allows detection of information related to the user's

screen.

http://www.javascriptkit.com/jsref/screen.shtml

Recommended BOM Resource

http://javascript.about.com/od/browserobjectmodel/Browser_Object_Model.htm Docsity.com