Documentation

Settings

Select redirect type

  • Page on this site - select a page from a popup site map.
  • Any URL - Enter a full URL, even with a query string and #id.

 

A message to display with the link

This is a text message that will be displayed within the redirect link. It may be briefly shown to users while the redirect is made. If you dont want any text, you can leave this empty.

Select redirect mode

  • Disable redirect behaviour - no redirect, useful for development and testing.
  • Upon a transition from hidden to visible - will not redirect if immediately shown.
  • Immediately when visible - redirects when shown.

 

Built in protections

Redirect When Visible will not show in edit mode.

Redirect When Visible will block linking back to the page it is on. This is a simple page ID and URL check, so if you have good reasons to beat it you surely can.

Setting 'Upon a transition from hidden to visible' mode in the edit dialog will change the redirect behaviour from immediately redirecting to redirecting on a transition from hidden to visible. In this mode, if a block shows immediately when a page is loaded, the redirect will not happen. The block needs to be hidden and then revealed again before the redirect will be made.

What does Visible mean?

Visibility is judged by the jQuery :visible selector, as described in http://api.jquery.com/visible-selector/

Elements are considered visible if they consume space in the document. Visible elements have a width or height that is greater than zero.

Elements with visibility: hidden or opacity: 0 are considered visible, since they still consume space in the layout. During animations that hide an element, the element is considered to be visible until the end of the animation. During animations to show an element, the element is considered to be visible at the start at the animation.

Probelm Solving

Sometimes the 'disabled in edit mode' message can shows after an edited page is published. This is a not uncommon random glitch for many blocks that have a separate edit message. Clearing the cache should sort it out.

Getting out of trouble

If you have problems getting back into a page to edit it, or have inadvertently created an infinite loop of redirects, Redirect When Visible can be disabled globally by any of:

1. A dashboard page at Dashboard > System & Settings > Basics > Redirect When Visible.

2. Setting a constant REDIRECT_WHEN_VISIBLE_ENABLE in config/site.php

define('REDIRECT_WHEN_VISIBLE_ENABLE', false);

3. Using phpMyAdmin to clear the Config table entry REDIRECT_WHEN_VISIBLE_ENABLE.

Remember you can also revert a page version using the Dashboard > Sitemap.

Templates and Themes

Redirect When Visible includes a template that shows a throbber while waiting to redirect. Further templates can be added using the usual concrete5 block template overrides.

Take care to leave all the view code alone save for the last part which is commented in the file as the part you can alter for templates.

The containing div element and the actual link element both have a class 'redirect_when_visible' that can be used in themes to style the block.