10 Awesome Javascript Features Every Web Developer Should Know.

10 Awesome Javascript Features Every Web Developer Should Know.

In this javascript article we will see 10 cool javascript BOM(Browser Object Model) features or hacks. let's talk about 10 JavaScript Features without wasting your time.

1. Window Location Href and Window Location Assign :

    window.location.href returns the href (URL) of the current page.

    window.location.assign() method loads a new document.

2. Window History Back , Window History Forword , history.go() :

    window.history.back() method loads the previous URL in the history list.This is the same as clicking the Back button in the browser.

    window.history.forward() method loads the next URL in the history list.This is the same as clicking the Forward button in the browser.

    Use history.go(1) go to 1 page forword or Use history.go(-1) go to 1 page back. This is the same as clicking the Back or forword button in the browser.

3. Window Location Hostname :

    window.location.hostname property returns the name of the internet host (of the current page).

4. Window Location Protocol:

    window.location.protocol property returns the web protocol of the page like https or http.

5. Window Screen Width And Height:

    screen.width property returns the width of the visitor's screen in pixels.

    screen.height property returns the height of the visitor's screen in pixels.

6. LocalStorage (set and clear):

    If you want to cache some application data in the browser for later usage than your can can use localstorage.

7. Window Location Port :

    window.location.port property returns the number of the internet host port (of the current page).

8. Window Location Pathname :

    window.location.pathname property returns the pathname of the current page.


9. Open New Window:

    open() method opens a new browser window, or a new tab, depending on your browser settings and the parameter values.

10. Target Elements In DOM Without Its Id Or Classes :

    Use $0 will always point to the last node you selected and you can change that element styles.

Post a Comment

0 Comments