html Miva - 禁用客户端维度刷新
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html Miva - 禁用客户端维度刷新相关的知识,希望对你有一定的参考价值。
<mvt:if expr="s.request_method NE 'POST'">
<script language="JavaScript">
function clientdimensions_cookieIsSet( name )
{
var i, cookies, cookie_name, values;
cookies = document.cookie.split( ';' );
for ( i = 0; i < cookies.length; i++ )
{
values = cookies[ i ].split( '=' );
if ( values.length )
{
cookie_name = values[ 0 ].replace( /^\s+|\s+$/g, '' );
if ( name == cookie_name )
{
return true;
}
}
}
return false;
}
function clientdimensions_getWindowWidth()
{
if ( window.innerWidth ) return window.innerWidth;
else if ( document.documentElement && document.documentElement.clientWidth ) return document.documentElement.clientWidth;
else if ( document.body && document.body.clientWidth ) return document.body.clientWidth;
}
function clientdimensions_getWindowHeight()
{
if ( window.innerHeight ) return window.innerHeight;
else if ( document.documentElement && document.documentElement.clientHeight ) return document.documentElement.clientHeight;
else if ( document.body && document.body.clientHeight ) return document.body.clientHeight;
}
setTimeout( function()
{
var clientdimensions_reload;
clientdimensions_reload = !clientdimensions_cookieIsSet( 'mm-clientdimensions-width' ) || !clientdimensions_cookieIsSet( 'mm-clientdimensions-height' );
document.cookie = 'mm-clientdimensions-width=' + clientdimensions_getWindowWidth();
document.cookie = 'mm-clientdimensions-height=' + clientdimensions_getWindowHeight();
clientdimensions_reload = false; // Disable refresh to avoid duplicate server/hosting/traffic resource usage
if ( clientdimensions_reload && clientdimensions_cookieIsSet( 'mm-clientdimensions-width' ) && clientdimensions_cookieIsSet( 'mm-clientdimensions-height' ) )
{
if ( window.stop )
{
window.stop();
}
location.reload( true );
}
window.onresize = function( event )
{
document.cookie = 'mm-clientdimensions-width=' + clientdimensions_getWindowWidth();
document.cookie = 'mm-clientdimensions-height=' + clientdimensions_getWindowHeight();
}
}, 0 );
</script>
</mvt:if>
<mvt:if expr="l.settings:clientdimensions:detected">
<mvt:if expr="l.settings:clientdimensions:width GE 1170">
<mvt:assign name="l.settings:clientdimensions:class" value="'x-large'" />
<mvt:elseif expr="l.settings:clientdimensions:width GE 960">
<mvt:assign name="l.settings:clientdimensions:class" value="'large'" />
<mvt:elseif expr="l.settings:clientdimensions:width GE 768">
<mvt:assign name="l.settings:clientdimensions:class" value="'medium'" />
<mvt:elseif expr="l.settings:clientdimensions:width GE 640">
<mvt:assign name="l.settings:clientdimensions:class" value="'small'" />
<mvt:else>
<mvt:assign name="l.settings:clientdimensions:class" value="'x-small'" />
</mvt:if>
</mvt:if>
以上是关于html Miva - 禁用客户端维度刷新的主要内容,如果未能解决你的问题,请参考以下文章