Sunday, August 3, 2014

Browsers Object Model (BOM) Location

-Window and screen objects:
-Location object:
  • its one of the objects of our browsers just the Window and Screen objects 
  • this object is used to get the URL of the current page you are running on your browser and redirect the browser to another new page
-Location object properties:
  • location.href: this return the (URL) of the current page 
  • location.hostname:it'll give you the host name of your page for example www.google.com thats a host name but http://images.google.com this is an URL
  • location.pathname: it'll return the path name of the URL for example our page URL is :
          URL:http://www.basel.com/computer/downloads/blogger.exe
          Host Name:www.basel.com
          Path Name:computer/downloads/blogger.exe
  • location.protocol: protocol is the way your browser connect to the web sites and for most web pages the protocol is HTTP and lets see some of them
  1. HTTP: For web pages
  2. SMTP:For mail sending
  3. FTP:Transfer files
  4. VOIP: For video calling just like Skype
  5. DNS: All websites on the internet have addresses so this protocol is used by the browsers to get the Ip of the page you wanted and give it back to your browser
  6. POP3:Mail sending
  7. UDP and TCP : these are connections protocol
  8. All these protocol aren't very important for web developing you don't have to learn a lot about them just read some information about what they do.
-Location methods:
  • location.assign(URL): this method is used to load a new document(Page)  in your page you can pass the URL by putting it as a parameter

-Related to this post:







No comments:

Post a Comment