CSS Chapter 4
CSS Chapter 4
Browser Data:
1. Opening a Window
- You can open a new browser window using `window.open()`. This method
allows you to define the URL, window name, and window features like size.
Code:
let childWindow = window.open("child.html", "Child Window",
"width=400,height=300");
3. Window Position
- You can set the position of the new window by specifying `top` and `left` in
`window.open()`. This controls where the window appears on the screen.
Code:
let childWindow = window.open("child.html", "Child Window",
"width=400,height=300,top=100,left=200");
2. JavaScript Security:
JavaScript is vulnerable to attacks like XSS and CSRF, which can steal data or
perform unauthorized actions. Always validate inputs and use security
measures like CSP.
3. Timers:
JavaScript uses `setTimeout()` to delay actions and `setInterval()` to repeat
them at set intervals. This is useful for animations or timed tasks.
4. Browser Location:
The `window.location` object controls and retrieves information about the
current URL. It can be used to redirect users or reload the page.
5. Browser History:
JavaScript can access and navigate the browser’s history using
`window.history`. This lets users move back or forward through pages with
code.