Coldfusion - how to deliver different content for mobiles (at server level) - coldfusion

Is there a way for coldfusion to reliably detect when the user is on a mobile (narrow screen) device (so I can deliver different content to them).
I appreciate I can use css media queries to change how the content is displayed (or not) but I would ideally like to re-order some of my blocks of content and also not send some larger content to mobile users.
ie
[cfif user_is_on_a_mobile]
small content
[cfelse]
large content
[/cfif]
Thanks very much indeed.
Nick

Check http://detectmobilebrowsers.com - it has a CF script you can use to detect mobile browsers.

Related

Is a web page without text fields and text areas immune to XSS?

If a web page comprises of drop downs,radio buttons,check boxes etc for user input and avoid text fields and text area to evade untrusted data(malicious javascript entered by the user).
Is such a web page immune to XSS?
If not how to secure such an application using ESAPI.
You can edit the form in your browser using for example Firebug and just add any field with any name.
Even more so, you can just forge whole post/get requests with any data you like (using curl or many other tools).
So: no, it is not.
Not necessarily. The input type doesn't matter, because requests can be spoofed (easy with GET, but not too hard with POST requests). What matters is that the result of the form is sanitized before inserting it into the page.

iFrame srcdoc - possible to use dynamic content / regex? HTML5

I know the srcdoc in iframes is relatively new (hence why I've been unable to find much iformation on it), but I've been wondering (and hoping!) if it's possible to use it dynamically, i.e. to take a section of a website and display it in an iframe?
For example, say I'd want to take just the breaking news section of the BBC website where the content keeps changing and put that in an iframe, just that bit, is the srcdoc able to do that?
This is not possible, and this is also not what srcdoc is designed for. The srcdoc attribute is available in WebKit browsers to set the content of an iframe rather than have it load a separate page from the server. Learn more about it at w3schools.
If you have an iframe with a page from another server (like the BBC website) then you have no way of accessing that page to extract or manipulate its contents because of the browser's same-origin policy.
The way to do it is having a server-side script downloading the BBC page, manipulating it and sending it to the client.

Can I access Flash data before they are rendered by the browser?

Is it possible to read numbers and names from a Flash page before they are rendered by the browser ? The webpage is changing dynamically and I would like to capture the data every about 60 minutes.
I have no access to the Flash website but I might be able to modify an open source browser if this would help. OS is Win 7 and I can speak a little C++.
The data is chnaging dynamically means that there is some page at backend serving to the flash page. Use a sniffer (such as ethereal) to know the serving page. Then you can call the page directly.
Another solution might be create a screenshot of browser and then pass this to a OCR
http://www.codeproject.com/KB/dotnet/simple_ocr.aspx

How can I open my application by default, if I click a URL through Browser in Symbian OS 5th ed

I want to open/start my application when a I click on a particular URL from the browser for
Symbian OS Series60 5th edition.(So, if I click on a "station" Url, it will start my application & play through my player)
Any possible way that I can get it to do this?
I won't offer any guarantee that you can do this on your own.
I suggest you start by reading the documentation for the Nokia Content Handling Framework.
However, there is a difference between the Operating System understanding that a specific MIME type should be handled by a specific application and the Web Browser actually allowing that to happen.
Several Web browser can be installed on a Series60 5th edition handset. I'll assume you are only interested in the default Webkit-based web browser already included in the phone but you need to be aware that it may not be the one the phone owner will ultimately use on a regular basis. Opera Mini is very popular and it certainly won't allow you to do what you want here.
Even with the default Webkit web browser, it is very possible that you won't be able to do what you want without at least some support from the handset manufacturer since you rely on either:
The Symbian Content Handling Framework being able to consider the scheme of a URL (instead of just a MIME type) as a content identifier and the Web Browser being fully integrated with the Content Handling Framework
or the Web Browser allowing you to write a plugin that makes it able to understand what is basically a new URL scheme (a URL not beginning with "http://"), display it as a hyperlink (you might just get that right now on your phone without doing any work. it's worth a try.) and behave the way you want when the user activates the hyperlink.
There is one alternative worth attempting: Keep the "http://" URL scheme but make sure your web server returns your own MIME type in the HTPP headers when it receives a HTTP GET request for the data.
Obviously, you will need your application installed on the handset and able to handle that MIME type.
You have a better chance of the default Web Browser being sufficiently integrated with the operating system already for this to work.

pushing content to cell phones

I am working on a photo site and one of more active users asked about pushing content to cell phones. The site is built on django, and I was wondering if anyone knows a good way of allowing users to download and store content (images) on their cell phones?
As a side question... is it possible to accept payment for the content via the cell phone or would that have to take place on the site?
The best way to serve content to a mobile user would be to forward them to a mobile specific site. A lot of places do this by forwarding the user to http://m.mydomain.com/. You can tell if they're using a cellphone by checking against their UserAgent string as Harold said. Find more at: Change Django Templates Based on User-Agent
In terms of downloading, this is pretty phone dependant. On my iphone, for instance, I don't know that I can save images directly from the internet. (This could just be my ignorance, however). I think you're going to run into a lot of discrepencies on the browsers between different mobile devices. How many offer photo downloads vs. not, etc.
For payment, I would suggest keeping it in browser. There is SOO much that could go crazy on a cell phone and money isn't one of those places where I like to take risk. That being said, you could likely look into some sort of sms micro payment system (sorry, I don't have any recommendations) or look at partnerships with carriers such as Verison. Beyond that, I'd say keep it in the App.
Hope it helps.
Check to see if the User Agent of the phone(s) you wish to support is in request.META['HTTP_USER_AGENT']. If so, render mobile friendly templates.