Create a Joomla module which loads another page in X seconds

For a project of ours, we were in need of a solution that allowed our Joomla site to automatically load another page (on that site) after a set period of time. After some thinking, we came up with a rather simple solution which you can easily implement on your own.

Instructions

  1. Install Sourcerer by Nonumber on your Joomla! site. We will be using this to “create” the module.

  2. Create a new Module (Extensions > Module Management)

  3. Give your module a title (anything goes, really)

  4. Assign the module to a module position.

  5. Then, assign the module to the page on which you want to load the other page after x seconds.

  6. In the editor – use the HTML editor, not the WYSIWYG editor, paste the following:

[code language=”javascript”]
{source}
<script>
var url = "http://urlyouwanttoload.com"
var time = 2000
window.setTimeout(function(){ window.location.href = url}, time);
</script>
{/source}

[/code]

  • Replace the value for url with your own URL.
  • Replace the value for time with how long you want to wait to load the other page. 1000 = 1 second.
  1. Once that’s all said and done, save the module. When you visit the page you assigned the module to, you will see that it will load the page you’ve chosen after the set time.

This solution comes from the dark depths of the Cloud-expert Office . Say hello on Twitter!

Discover more from PowerUser Guide

Subscribe now to keep reading and get access to the full archive.

Continue reading