Forums

[resolved] Preview iframe issue (2 posts)

  1. Covi
    Member
    Posted 1 year ago #

    If you have a script to block the iframing capture technique, the Theme Preview (I think it uses thickbox) doesn't work.

    Does any elegant idea?, by checking referer perhaps?

    S!, srry lang.

  2. Covi
    Member
    Posted 1 year ago #

    Ok, my solution in case someone needs it:

    <?php
    // Comprobamos el referer para no bloquear el preview de themes propio:
    if ( isset($_SERVER['HTTP_REFERER']) && '' != $_SERVER['HTTP_REFERER'] )
    	$realReferer = parse_url($_SERVER['HTTP_REFERER']);
    	$selfReferer = parse_url($siteurl);
    	//DEBUG: echo $realReferer['host'] . ' = ' . $selfReferer['host'];
    	if ($realReferer['host'] != $selfReferer['host']) :
    ?>
    <!-- Prevent your web under iframes -->
    <script type="text/javascript">
    //<![CDATA[
    	//DEBUG: alert('No frames active.');
    	if (self.parent.frames.length != 0)
    	self.parent.location=document.location.href;
    //]]>
    </script>
    <?php endif;

    Hope it is useful.
    S!

Topic Closed

This topic has been closed to new replies.

About this Topic