Jump to content

Desactivar volver atrás y vaciar cache.


djmortis

Recommended Posts

Buenas, estoy intentando desactivar el botón del navegador "volver atras" en la pantalla de confirmación del pedido y que vacíe la cache y no hay forma.

 

en el order.confirmation.tpl en themes, pongo lo siguiente:

<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>

Con esto tendría que funcionar pero no lo hace.

 

¿Alguna idea de porque no funciona?

 

Gracias.

Link to comment
Share on other sites

Buenas, estoy intentando desactivar el botón del navegador "volver atras" en la pantalla de confirmación del pedido y que vacíe la cache y no hay forma.

 

en el order.confirmation.tpl en themes, pongo lo siguiente:

<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>

Con esto tendría que funcionar pero no lo hace.

 

¿Alguna idea de porque no funciona?

 

Gracias.

Prueba con este codigo...

<meta http-equiv="Expires" content="0" /> 
<meta http-equiv="Pragma" content="no-cache" />
 
<script type="text/javascript">
    setTimeout(function() {
        window.history.forward();
    }, 0);

    window.onunload = function() { null };
</script>

Tambien asegurate de que el codigo se este ejecutando correctamente en la pagina en la cual lo necesitas.

Link to comment
Share on other sites

Gracias COTOKO, pero me da que al ponerlo en order.confirmation.tpl sigue sin hacer nada, creo que no lo estoy poniendo en el fichero adecuado. Sabes que fichero es el de la última pantalla, una vez ya has pagado, la pantalla de confirmación?

 

Gracias.

Link to comment
Share on other sites

Lo querría poner en la confirmación de pago cuando se ha elegido transferencia bancaria o giro postal. Vamos, cuando haces un pedido por uno de esos dos metodos de pago, en la última página, la de confirmación del pedido.

 

Lo he puesto también en el payment_return.tpl del modulo bankwire en el theme y tampoco funciona ahí. :/

 

Llevo 2 horas con ello y ya no se donde más ponerlo para que funcione.

 

Gracias de nuevo.

Edited by djmortis (see edit history)
Link to comment
Share on other sites

Creo que esos módulos is utilizan el hook para la confirmación del pedido, por lo que debería valerte poner el código en el archivo antes mencionado, quizá tienes habilitado el cache, seria prudente que vaciaras el cache desde la pestaña rendimiento, también cuando estés en la pagina de confirmación inspecciona el cogido fuente y revisa que si te aparezca el código, para que por lo menos tengas claro si es que no funciona o si es que sigue sin aparecer.

Link to comment
Share on other sites

Vale, era problema del código, he encontrado otro código lo he puesto en el orden_confirmation.tpl y solucionado.

 

El código lo que hace es que aunque le des a volver en el navegador te deja en la misma página.

 

Lo dejo por si a alguien le vale.

<script type="text/javascript">
window.onload = function () {
    if (typeof history.pushState === "function") {
        history.pushState("jibberish", null, null);
        window.onpopstate = function () {
            history.pushState('newjibberish', null, null);
            // Handle the back (or forward) buttons here
            // Will NOT handle refresh, use onbeforeunload for this.
        };
    }
    else {
        var ignoreHashChange = true;
        window.onhashchange = function () {
            if (!ignoreHashChange) {
                ignoreHashChange = true;
                window.location.hash = Math.random();
                // Detect and redirect change here
                // Works in older FF and IE9
                // * it does mess with your hash symbol (anchor?) pound sign
                // delimiter on the end of the URL
            }
            else {
                ignoreHashChange = false;   
            }
        };
    }
}
</script>

Y el archivo completo queda así.

{*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2014 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}

{capture name=path}{l s='Order confirmation'}{/capture}

<h1 class="page-heading">{l s='Order confirmation'}</h1>

{assign var='current_step' value='payment'}
{include file="$tpl_dir./order-steps.tpl"}

{include file="$tpl_dir./errors.tpl"}

{$HOOK_ORDER_CONFIRMATION}
{$HOOK_PAYMENT_RETURN}
{if $is_guest}
	<p>{l s='Your order ID has been sent via email.'}</p>
    <p class="cart_navigation exclusive">
	<a class="button-exclusive btn btn-default" href="{$link->getPageLink('guest-tracking', true, NULL, "id_order={$reference_order}&email={$email}")|escape:'html':'UTF-8'}" title="{l s='Follow my order'}"><i class="icon-chevron-left"></i>{l s='Follow my order'}</a>
    </p>
{else}
<p class="cart_navigation exclusive">
	<a class="button-exclusive btn btn-default" href="{$link->getPageLink('history', true)|escape:'html':'UTF-8'}" title="{l s='Back to orders'}"><i class="icon-chevron-left"></i>{l s='Back to orders'}</a>
</p>
{/if}
{literal}

<!-- Google Code for Compras Conversion Page -->
<script type="text/javascript">
window.onload = function () {
    if (typeof history.pushState === "function") {
        history.pushState("jibberish", null, null);
        window.onpopstate = function () {
            history.pushState('newjibberish', null, null);
            // Handle the back (or forward) buttons here
            // Will NOT handle refresh, use onbeforeunload for this.
        };
    }
    else {
        var ignoreHashChange = true;
        window.onhashchange = function () {
            if (!ignoreHashChange) {
                ignoreHashChange = true;
                window.location.hash = Math.random();
                // Detect and redirect change here
                // Works in older FF and IE9
                // * it does mess with your hash symbol (anchor?) pound sign
                // delimiter on the end of the URL
            }
            else {
                ignoreHashChange = false;   
            }
        };
    }
}
</script>
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 969553932;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "5y2VCsldsmV0Q8u-ozgM";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/969553932/?label=5y2VCsldsmV0Q8u-ozgM&guid=ON&script=0"/>
</div>
</noscript>
{/literal}

Gracias de nuevo por todo.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...