Loading of content [with widget rules]

January 2013 WordPress Theme
GK User
Mon Feb 11, 2013 11:31 am
I have put two different javascripts on my page.
One is to be loaded on desktop other on mobile.
I want to know that are both the javascripts loaded both on desktop and mobile, but only one is visible due to widget rules, I have set. If so, then is it possible to load only that javascript which according to widget rules should be loaded on a specific platform. This will reduce page load.
User avatar
Senior Boarder

GK User
Mon Feb 11, 2013 11:52 am
Hi,

Unfortunately it is currently not possible, because blocks for the mobile devices are only hidden on the desktop devices.
User avatar
Administrator

GK User
Mon Feb 11, 2013 1:34 pm
So, it's not possible to do this on this theme? But technically are there any codes which can perform the tasks I asked for
User avatar
Senior Boarder

GK User
Mon Feb 11, 2013 2:33 pm
Technically you can try to use the browser object available in the global $tpl object:

Code: Select all
if($tpl->browser->get("mobile") == true) {
    echo "It's mobile!";
}


but then the code will be executed only on the mobile devices, so if you will resize your window then the code won't be executed on the desktops.
User avatar
Administrator

GK User
Tue Feb 12, 2013 6:28 am
Thanks.

Can this feature be expected in upcoming versions of this theme?
User avatar
Senior Boarder

GK User
Tue Feb 12, 2013 9:34 am
I'll consider this :)
User avatar
Administrator

GK User
Tue Feb 12, 2013 8:22 pm
Thanks a lot.
That will definitely an added value to the users of gavick themes. Hope to see that feature soon.

Let me also say - You guys are doing a great job. The support is just awesome. Thanks again. :)
User avatar
Senior Boarder


cron