Quick question on my HTML and JAVASCRIPT for an awesome home page trick: different home pages on different days


Quick question on my HTML and JAVASCRIPT for an awesome home page trick: different home pages on different days

I was given this HTML and JavaScript. Can you tell me how to modify it to include multiple website tabs? So on "Monday" I want to load three webpages with firefox and not just http://ift.tt/1OIbmnY


Initial question:

I want Firefox to have different homepages on different days. Something like this:

Mon – http://ift.tt/1OIbmnY

Tues – http://ift.tt/mNSUQY

Wed – r/lifeprotips


Answer:

In the HTML file all you need is a basic skeleton with a script tag. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> http://homepage.js </body> </html>

In the JavaScript, set up a method of checking the day.

switch (new Date().getDay()) { case 1: location.href = "http://ift.tt/1OIbmnY"; break; case 2: location.href = "http://chronicle.com/"; break; case 3: location.href = "http://ift.tt/2utXiu5"; break; }

Save this as homepage.js in the same folder as the html above. new Date().getDay() returns the current day of the week as a number (0 for Sunday, 1 for Monday, 2 for Tuesday, etc). The case then specifies what to when it is a certain day.

Submitted July 18, 2017 at 09:16AM by wanderlust_0_
via reddit http://ift.tt/2tak0TO

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s