• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Detect Screen Width Cold Fusion 9

Community Beginner ,
Oct 26, 2016 Oct 26, 2016

Copy link to clipboard

Copied

We are trying to execute a cfinclude determined by screen width on our responsive website. This if for determining the number of ads that will appear on the page (we want to show a fixed number on screens of 700px or less). We are using Cold Fusion 9 so we can't utilize CF 11's detectDevice function. We realize we can't just use media queries to show or hide the appropriate cfinclude because this will not prevent CF from loading unnecessary ads in the background, it will just hide them and our page speed will be affected. Is Javascript the only way to do this? If so, can someone provide an example without Jquery?

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Oct 26, 2016 Oct 26, 2016

I would suggest either learning javascript or better yet, learn javascript and incorporate a responsive framework like bootstrap 3. Trust me, maintaining width specific include modules on the server will rapidly become a nightmare for you or whoever inherits the project.

Votes

Translate

Translate
LEGEND ,
Oct 26, 2016 Oct 26, 2016

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 26, 2016 Oct 26, 2016

Copy link to clipboard

Copied

We are novices when it comes to javascript. We see plenty of examples on how to determine width with javascript but we're not sure what exactly we are doing with that information; how we are showing cfinclude 1 for 700px or less and cfinclude 2 for everything else. We were hoping there was another way to do this with just Cold Fusion (9).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 26, 2016 Oct 26, 2016

Copy link to clipboard

Copied

I would suggest either learning javascript or better yet, learn javascript and incorporate a responsive framework like bootstrap 3. Trust me, maintaining width specific include modules on the server will rapidly become a nightmare for you or whoever inherits the project.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 26, 2016 Oct 26, 2016

Copy link to clipboard

Copied

It seems to me like you are trying to use a server side process to do something that belongs in the UI.  As Steve suggests, you should really get a better understanding of JS and handle the issue there.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 26, 2016 Oct 26, 2016

Copy link to clipboard

Copied

Thank you for your time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 23, 2019 Jun 23, 2019

Copy link to clipboard

Copied

LATEST

There is a way to do it in ColdFusion 2018.

<cfclientsettings detectDevice=true />

<cfclient>

<cfif cfclient.properties.width lte 480>

Be aware that the Adobe documentation has a typo "cfclient.width" leaving the "properties" out.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation