if statement - Mobile redirect using jquery -


mobile redirect jquery

today ask first question here since need little code , idea....

my first problem if in first part of code, should ask device-desktop true , search in tabletbox existing p , executing code refresh in tablet-view. somehow doesnt while both conditions should valid guess mistake in if-code, got fix?

my next problem referring url , place "?uselayout=tablet" behind it.

the final function should work this:

script asks if (device.tablet) in case true, ask if division exists on tablet-layout not loaded, if both conditions valid should referrer url, put ?uselayout=tablet behind , reload. since division there after reload stop on every next pageload without refresh.

if ((device.desktop()) && ($('.tabletbox').find('p').length > 0))  { console.log( "umleitung aktiv" ); window.location.replace("https://www.url.de/de/?uselayout=tablet");} else {console.log( "umleitung nicht-aktiv" );} 

update #1

my final script looks now:

<script type="text/javascript"> $(document).ready(function() { if (device.tablet() || device.mobile()) {console.log( "tablet umleitung aktiv" ); window.location.replace("https://www.url.de/de/?uselayout=tablet");}     else {console.log( "tablet umleitung nicht-aktiv" );} }); </script> 

i dont need check element on page anymore since removed script mobile layout. , yes need like

window.location = window.location + '?uselayout=tablet' 

but needs auto-load new url... code automatically redirect? , how implement it? ;)


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -