window.location.href will return the complete web address you are currently on, in a string. This is also known as the URL.
window.location.hostname will return just the domain name in a string, for example, "www.samplesite.com."
window.location.pathname will return the path, which is the text after the .com (as an example). If the browser is on the site's home page, this will return "/". It won't return the anchor though. The anchor is the # followed by text at the end of some paths.
window.location.hash will return the anchor, for example, #randomanchor at the end of the path. If there is no anchor, an empty string will be returned, "".
So those are my notes from yesterday. Now that I've reviewed them, I'll continue on.
All right, it's been a few days now, so I read the chapter again and also read my notes above and now I'm going to complete the problems.
Okay, I finished that chapter, now I'm on Chapter 77 Browser Control: Getting and Setting the URL Another Way.
In this chapter, we used this code:
window.location/assign("http://www.yahoo.com/sample1.html#4");
That takes the browser to that specific url. You can use a variable in the parentheses if you like.
window.location.replace("http://www.yahoo.com/sample1.html#4");
That does the same thing, except when you use that code, the original page doesn't make it into the history, so if the user presses backspace, the user is taken to the page before the original page, or nowhere if there was no page before that. In the previous code, the backspace key works like it normally would.
Okay, I finished chapter 77.
Now I'm on Chapter 78 Browser Control: Forward and Reverse. Finished that chapter.
Now I'm on Chapter 79 Browser Control: Filling the Window with Content. This code makes a popup window:
var monkeyWindow = window.open();
Now I'm on Chapter 80 Browser Control: Controlling the Window's Size and Location.
Now I'm on Chapter 81: Browser Control: Testing for Popup Blockers.
Okay, I'm done with chapter 81.
Now I'm on Chapter 82 Form Validation: Text Fields.
SUMMARY OF CODING SKILLS
Total Treehouse Points: 5,385
Treehouse Points by Subject Matter (Miscellaneous not included):
HTML: 663
CSS: 1,599
Design: 1,193
Development Tools: 747
Javascript: 1,120
Treehouse Ranking (%): "You have more total points than 94% of all students."
Treehouse Badge(s) Earned Today:
Treehouse Courses Completed:
How to Make a Website
HTML
CSS Foundations
CSS Layout Techniques
Aesthetic Foundations
Design Foundations
Adobe Photoshop Foundations
Adobe Illustrator Foundations (66% complete, switched focus from web design to web dev)
Git Basics
Introduction to Programming
Javascript Basics
Codecademy (& other) Courses Completed:
HTML and CSS (Codecademy)
Design Foundations
Adobe Photoshop Foundations
Adobe Illustrator Foundations (66% complete, switched focus from web design to web dev)
Git Basics
Introduction to Programming
Javascript Basics
Codecademy (& other) Courses Completed:
HTML and CSS (Codecademy)
Books Read or in Progress:
Completed: "Head First HTML and CSS," by E. Robson & E. Freeman
In Progress: "Eloquent JavaScript," by Marijn Haverbeke (On pg 27)
In Progress: "Head First Javascript," by Eric Freeman and Elisabeth Robson (On pg 56)
In Progress: "A Smarter Way to Learn Javascript," by Mark Myers (on pg 271)
My Progress on The Odin Project:
1. Introduction to Web Development 100% Complete
2. Web Development 101 29% Complete
3. Ruby Programming 0% Complete
4. Ruby on Rails 0% Complete
5. HTML5 and CSS3 0% Complete
6. Javascript and JQuery 0% Complete
7. Getting Hired as a Web Developer 0% Complete
Hours Spent Coding Today:3
Total Hours Coding: 609
No comments:
Post a Comment