Determining the clients device (PC or Mobile) - html

I am returing to website development and I want my work to be as global as possible. When a web surfer arrives at my site, is there a way to determine whether he/she is surfing with a PC or mobile phone and disply the content accordingly? Or would it be better to build responsive sites using CSS?

Take a look at the following questions, looks like there could be quite a lot of useful information in there for you:
What is the best way to detect a mobile device in jQuery?
How to detect a mobile device with JavaScript?
Auto detect mobile browser (via user-agent?)

You can use Request.UserAgent because UserAgent gets the raw user agent string of the client browser

Related

How to set up apache to serve dynamic html? Same url for different devices

I want to set up dynamic html serving on my apache server. It means that for different types of devices (mobile, tablet, desktop) content should be different, while url stays the same.
For example:
From desktop www.example.com/index.html
Completely different layout
From mobile device www.example.com/index.html
Completely different layout
How to achieve this? What would be apache configuration?
I don't want to use RWD because layout between devices differs too much.
I'm not familiar enough with Apache to say this definitively but I don't think you can actually serve different webpages on the same url without some sort of server side page generation (such as a web application framework).
However, if you have a normal site on www.example.com and a mobile-friendly site on m.example.com you can configure Apache to redirect users of a mobile device to your mobile site.
Google "Apache detect mobile device" and you see links such as http://blog.justin.kelly.org.au/apache-mobile-device-detection/ which seems to do pretty much exactly that.
One warning is in order: the detection is based on the user agent string and is therefore comprised of fuzzy logic; some user agents (some devices) might not be detected correctly. I would therefore advise you to also have a link at the top of your 'normal' webpage to users can click to get to your 'mobile' webpage.

Is it possible to make a website that is accessible strictly by using QR code?

I want to make a website that will only be accessible by people who use the link I put on the QR code.
Is such thing possible? Can a website recognize if the request is coming from html browser or mobile device?
No. Anyone could access the site via the same URL. You could try to use the user-agent string to try to limit access to mobile browsers, but a) this could prevent some mobile users from accessing the site, and b) all methods of detecting mobile browsers are easily spoofed.

Desktop site link from mobile site

I am working on a site that has a mobile site: http://www.exchequersolutions.co.uk/m/ I am trying to create a link to the desktop site with out much luck.
When the user clicks on a link I want them to be taken to the desktop site.
The link in the anchor tag is:
<p><a href="http://www.exchequersolutions.co.uk/contractors/cis-self-employed/cis-form/" target="_blank" class="cis_register" >Register Online</a></p>
Does anybody know how or even if this is possible?
Is not possible.
Every browser implement a function to save a link on OS FileSystem (drag&drop or file > save as ...).
You're stuck in a loop caused by user-agent detection.
It looks like there is device detection on the desktop site that uses the user-agent to identify mobile devices. If you follow a link to the desktop site using a mobile phone, you'll just be sent back to the mobile site.
There are a few different ways you can fix this, but it depends on your site architecture. One way would be to disable the redirect on the desktop site if you include a specific parameter in the query string. Another option would be to set a cookie and use that to disable the redirect.

1 HTML5 code to rule them all

We're new to mobile. We have our HTML5 page (w/ PHP) up and running live. We now want to go mobile. Whether it's a native app or mobile web doesn't make a difference in our situation. We just want to have 1 set of code to maintain (with only minor tweaks here or there for different platforms). We've played around somewhat with Titanium & Phonegap but it seems like we have to make a LOT of modifications to our HTML5 code.
When people talk about a "mobile web app" (ie http://techcrunch.com/2011/11/18/financial-times-mobile/) what do they mean? Is it simply loading our HTML5 website from an iphone? If not, what development frameworks should we use? thx!
I don't see much difference between a mobile web app and a web app. Browsers on smartphones are sometimes even better then browsers people use at home...
Things you should really keep in mind are screen sizes and no mouseover effects.
Common used technologies for a mobile web app are:
HTML 5, CSS , JS , jQuery, jQuery Mobile (which was released 1.0 a few days ago!)
Server technologies are pretty much the same.
In order to generate the impression of a native app you could then use Phonegap.
I recommend using the Sencha framework for mobile apps. It makes your HTML5 app look like, and feel like a native app for any phone OS.
You can surely implement a mobile web application by implementing it as a web application. Obviously you have to give special consideration to the targeted mobile devices, and do lots of prototyping & testing. Browsers are really getting better on the mobile devices - so that's something good.
If you can create the experience you want in a web application, then great! As of now many developers find it worthwhile to write applications that directly target mobile devices, while also providing a web application. Once you have multiple kinds of clients, it's a good idea to implement the functionality in your application in a web API, which is accessible to the various clients (web app (browser), iOS app, Android app, etc.).

show off mobile sites in web portfolio?

Does anyone out there know if its possible to show a working version of a mobile site in a web portfolio? Wondered if there was an emulator that could be used for this purpose?
Any ideas, please give me a shout.
If you're using device detection on the mobile site, the easiest way would be to have a flag in your URL that will make the site think it's serving a mobile client and not a web client. This depends on your implementation, but spoofing the device is the easiest way. Makes it easier to debug as well.
this site shows samples of mobile sencha touch apps running in an iphone
http://www.synthphone.com/
below is a sample URL that links directly to google mobile site on a device with dimensions 320 x 480 (iPhone)
http://www.synthphone.com/?u=http://m.google.com&w=320&h=480
hope this gives you some ideas at least