Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This might be more of a Firefox question than a Linux software question, but I thought I'd give it a shot here since the answer would probably involve more than Firefox itself. Is there a way to make your home page change depending on the time of day?
That makes sense, although I use a laptop and it's not always on, so that would throw off the jobs. What would be the best way to handle it? I guess I could do a cron job every few minutes to check, but that doesn't seem to be the most efficient. Any other ideas, or should I just try to do something like that?
That'll work, thanks. One more thing... since I'm not too familiar with bash scripting could someone post a quick example that would test the time and, under various periods, change the address field in:
I'll go do the google work and figure it out, but if someone could give me a start on the structure of the cases and changing the file that would be much appreciated.
I'm not sure I know enough about Javascript either to change that from days to time and set up the cases. Are you saying forget about cron jobs and bash scripts and actually put it as Javascript in the user.js file? Would that get run every time Firefox opened?
not even in a .js file, you could run the javascript inline within the .html file (or .htm, .php etc). Javascript is interpreted by the browser, so it is run everytime the document is (down)loaded. You would not need a cron task to change the script, because the javascript would only show the wanted page. It would also be possible to do this in php. With Javascript, if the user clicked view source, then he would be able to see the other page's html. With php, because it is processed server side, the user would only see the html that you specify for that time. It would be quite easy in php. I'm not sure whether this would work but here goes!
PHP Code:
<?php $the_time = date('a'); # Lowercase Ante meridiem and Post meridiem # am or pm
if ($the_time == 'am') { include('morning.html'); # replace morning.html with the page for the morning } else { include('afternoon.html'); # replace afternoon.html with the page for the afternoon } ?>
As reference, you may need/want to look here for details on the php date() function. Here, the script is detecting whether it is morning (am) or afternoon (pm). Another way to do it would be to display the page imbetween 10am and 6pm, and any time after that display another page.
PHP Code:
<?php $the_time = date('H'); # 24-hour format of an hour with leading zeros # 00 through 23
if ($the_time <= 10) { if (!$the_time >= 18) { include('page1.html'); # replace as neccessary } else { include('page2.html'); # replace as neccessary } } else { include('page2.html'); } ?>
There is probably a far better way of doing this... To get this to work, you will need a httpd server such as apache with php support...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.