Disable the cache and the "back" button of the browser

0

I try to avoid on a web with Wordpress that after completing the user a CF7 form and get to the Thank you page, I can go back, disabling the browser button and erasing the cache.

For this, following the indications of Juliopari ( link ) I have inserted the following code in the header.php file:

<?php
// ELIMINA LA CACHE Y EVITA VOVER ATRAS TRAS REGISTRO DE SOCIO 151017 MAY   
if( is_page( array( 'apo9jh2bxh16') ) )
{
?>
<meta http-equiv="Expires" content="0" /> 
<meta http-equiv="Pragma" content="no-cache" />

<script type="text/javascript">
  if(history.forward(1)){
    location.replace( history.forward(1) );
  }
</script>
<?php   
}
// HASTA AQUI EL CODIGO DE PERSONALIZACION DE LA CACHE Y VOLVER ATRAS
?>  

Resulting the final code like this:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

<?php
// ELIMINA LA CACHE Y EVITA VOVER ATRAS TRAS REGISTRO DE SOCIO 151017   
if( is_page( array( 'apo9jh2bxh16') ) )
{
?>
<meta http-equiv="Expires" content="0" /> 
<meta http-equiv="Pragma" content="no-cache" />

<script type="text/javascript">
  if(history.forward(1)){
    location.replace( history.forward(1) );
  }
</script>
<?php   
}
// HASTA AQUI EL CODIGO DE PERSONALIZACION DE LA CACHE Y VOLVER ATRAS
?>  


<?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium-thumb' ); ?>
<meta property="og:image" content="<?php echo $thumb['0']; ?>" />
<?php } ?>
........

The truth is that I have tried it and it does NOT work.

I will appreciate your help.

    
asked by José Díaz 15.10.2017 в 12:31
source

0 answers