snippetjavascriptTip
Window.location Cheat Sheet
Viewed 0 times
javascriptlocationwindowcheatsheet
Problem
The
Provided the above URL, here's a quick reference for the properties
window.location object is particularly useful when working with a page's URL information. Let's take a look at an example of a URL and what each property of the window.location object represents.Provided the above URL, here's a quick reference for the properties
window.location object:- The protocol schema of the URL (usually
http:orhttps:) - Sample value:
https: - The domain name of the URL
Solution
const url = 'https://dev.30secondsofcode.org:8000/c/js?page=2&sort=asc#search';- The protocol schema of the URL (usually
http:orhttps:) - Sample value:
https: - The domain name of the URL
- Sample value:
dev.30secondsofcode.org - The port number of the URL
- Sample value:
8000
Code Snippets
const url = 'https://dev.30secondsofcode.org:8000/c/js?page=2&sort=asc#search';Context
From 30-seconds-of-code: window-location-cheatsheet
Revisions (0)
No revisions yet.