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.
Thank you for your time.
There is a way to do it in ColdFusion 2018.
<cfclientsettings detectDevice=true />
<cfif cfclient.properties.width lte 480>
Be aware that the Adobe documentation has a typo "cfclient.width" leaving the "properties" out.