I've got a Java web application running, when accessing via a mobile device (such as safari browser on an iPhone) the JSP page renders poorly. The device screen is not suitable for the page and therefore I'm looking for a way to get around this
After some Googling, I've come across the following line that can be added to a JSP
<link href="/css/global.css" rel="stylesheet" type="text/css" media="handheld" />
Is this a sufficient way of ensuring a web application can work on both desktop and mobile browsers, or have I overlooked this completely?
I've been advised to have a look to see what Spring MVC has available to use, but I think that could possibly be a red-herring piece of advice as the above would be simpler
Just specify the both styles. The client knows perfectly which one to choose based on the media type. Indeed use handheld
for mobiles (at least, the devices with a 300~400px wide screen).
<link rel="stylesheet" href="css/global.css" media="screen,projection">
<link rel="stylesheet" href="css/mobile.css" media="handheld">
<link rel="stylesheet" href="css/print.css" media="print">
You see, it's also able to add a specific stylesheet for printing devices. This is often overlooked as well.