Android "Request Desktop Site" for HTML - php

I'm designing a website for both mobile and pc applications. The website however does not display certain key elements on android devices, so I have created a separate mobile website. Is there any way I can prevent the user form being able to navigate to the desktop site from their android phone (using HTML, JS, PHP, etc.)?

Check out this site:
http://mobiledetect.net
When you already have two different sites you simply add a php script with the classes and codes from PHPMobileDetection and if it detects a mobile device, then you redirect to the mobile site.
This also work, so far as I know, with the Chrome Feature "Request desktop version".

Related

How to force user to open my website in safari when they access my wordpress site

My website has Facebook log in function, which does not work if user views my site on facebook app, messenger app, iOS chrome app, Gmail app of iPhone.
Therefore, I need to force user to open site on Safari in such case.
Is there any way to do that? My site is built by wordpress.
Thanks!
UPDATE 1: I am thinking about a javascript to detect if users is on iOS, then pop up a javascript to ask if user wants to view on safari. Is it possible?
If you are in an Apple app like Mail, Messages, Notes etc. It will open with Safari, but if you are in another app eg. Facebook, Twitter, anything developed by a developer, you can't choose how you want to handle URLs in their app, that is up to the developer, and as a developer and Apple guidelines, it is best to open URLs in app so that the user don't leave your app. They use Safari anyway as UIWebView is a component of Safari, and we use UIWebView to browse inside our apps. (This can be manipulated, but still doesn't change the answer as to where you can't control how to handle links inside apps.)
It's not possible to open a specific browser (Safari in your case) from a website.
If you're working on an app, you might want to have a look at SFSafariViewController.
Have a brief idea about different kind of webviews in iOS here

Share mobile logged in user details with PHP session

I am working on a mobile site that will run alongside a mobile app being developed by another company. My product manager has provided a spec, in which she is mentioning two options to implement a feature:
Clicking on button from mobile app will open mobile browser, where the user will need to login again, and proceed to perform required action.
Clicking on button from mobile app will open in-app browser, user does not need to login, and completes the entire flow and closes the in-app browser.
My question is: I do not understand difference between mobile browser and in-app browser. Does in-app just mean mobile browser opened from inside the app? And if that is so, then using PHP will I be able to recognize the current login in the app? or is there any way I can ask the mobile team to set a session when they open the "in-app" browser such that I can access that session and determine who is logged in?
As you can see, I am pretty ok with PHP and server side coding, but my knowledge of these new mobile technologies is very poor...I guess I am getting just too od for this job now.. sigh.
Any pointers are very much appreciated.
I think by in-app browser he has meant WebView which opens web pages as a part of application
This question seems to be duplicate although here is the ans you probably need.
Android WebView VS Phone Browser
Have you any doubts left?
mobile browser: a complete application inside the mobile device. Common examples are Chrome, Firefox mobile, Opera Mobile.
in-app browser: it's an instance of WebView. That's a normal view inside your app layout that is able to render web-content.
To open the webview as a currently app-logged user, you generally will add some token parameter to the URL that the web development team can use to identify the user on the server.
The WebView generally behaves like a browser, but you should implement a WebViewClient to properly steer some of the navigation patterns to make sure it behaves inside your app, the way your app should.

Build a mobile website without touching the original website

We just got a idea to show the power of mobile web to clients. So we were thinking to show clients website in mobile. So its obvious that we wont get access to client code or website. The client website is in PHP. So is there any external tool or application that we can use to configure the website on mobile, with out getting the actual code. Like we have Kurogo . But i found that the amount of effort needed in configuring it for a website is too much. So is there any simple tool which we can use. It should just handle images, links and basic content. Just take it and display properly in mobile
All requests made to example.com should be redirected to m.example.com and in m you provide the necessary web interface for mobile devices.
JQuery Mobile is very useful tool for building websites design for mobile.

How to load Desktop version of webpage through mobile PHP page (user agent settings?)

I have a PHP page (which is displayed through a mobile/android browser) - however, when accessing a link to an external site - it automatically redirects to the mobile version.
I want the link to take user to the desktop version of the webpage even when accessed through a mobile browser.
Is there a way i can specify useragent/or any other setting in my PHP page code to acheive this? Thanks.
Spoofing the user agent string will be a challenge, as it requires you to control the behavior of the browser. You might be able to do it with JavaScript or something, but I doubt it.
If it's just one site, you may wish to take a look at how they're handling redirection of mobile devices. Often, sites will provide mechanisms for overriding the redirect script.
For example, sites using the UC Mobile Web Framework (http://mwf.ucla.edu/) allows you to override their redirect script with a query string parameter. The UCSF Library (http://library.ucsf.edu/) is using that framework for mobile redirects. If you are on a mobile device and go to http://library.ucsf.edu/ then you will be redirected to the mobile version of the site. However, if you go to http://library.ucsf.edu/?ovrrdr=1 then you will get the desktop version.
What you are describing, no. You do not have control of an external site therefore you cannot control what is being served.

How to develop a mobile version website, without changing it's domain name?

I want to develop the mobile (also includes iphone,ipad,andriod) version of my original site. But I don't want to create another sub domain like www.m.mydomain.com, can i dynamically change the document root separately for mobile version and the existing one?
I have also noticed that, when I open facebook form iphone or any andriod mobile it opens with it's original domain name like http://www.facebook.com/ bt when i open it from any other mobile like nokia or samsung it comes with http://m.facebook.com/, what is the difference between this 2?
When it comes to iPhone and Android deveices, a website needs very little adjustments because their web browsering capabilities are really good.
For other devices where the web browsing user experience is less satisfying, the site would dynamically switch them to an alternate and less "intense" version of the website.
As for the m.domain.com feature, this is just a subdomain of the domain.com website. Obviously, it represents a mobile version of the main site and will strip out things like flash and javascript basically anything which will be too much for a basic mobile browser.
The dynamic switching of browsers is done via code. There are ways of detecting what browser just requested your website. Based on the information returned you can then redirect to specific scripts which will handle the user requests from then on.
As an example, you can use this standard argument to check the browsers visiting your site:
$_SERVER['HTTP_USER_AGENT']
Hope that helped.
You can differentiate it by User-Agent property either on Apache level, or PHP level. Though that will not be guaranteed because UA can be spoofed. (But how many mobile users would do UA spoofing to pretend they're not mobile?)
you could possibly use some solution:
create a specific mobile website and put it on folder/subdomain and redirect any user with mobile to that site, example: mydomain.com/m/ or m.mydomain.com
example on redirection:
http://detectmobilebrowsers.mobi/
http://mobiforge.com/developing/story/lightweight-device-detection-php
or
you could use responsive webdesign technique, some framework already available for this
http://csswizardry.com/inuitcss/
http://www.columnal.com/
http://stuffandnonsense.co.uk/projects/320andup/
The difference is that high end mobile devices like iphone/android have enough support and functionality to support the original version of the website (zooming/javascript etc). Other devices are better served an basic website developed for mobile devices with a limited display and/or support.
You do want an special URL for your mobile website - as you'd like your mobile website to correctly appear in the mobile search of search engines.
www is actually also a subdomain, but it is so often used, people do not usually realize it, Usually most browsers add it by default and this is why most servers have it enabled by default.
The case you pointed out is also of subdomains. The server check your HTTP request's user-agent and redirects you to the mobile subdomain appropriately.
This isn't really a quick solution for you, but I highly recommend reading Ethan Marcotte's Responsive Web Design articles on alistapart.org. He goes over the philosophy as well as the practical steps to make a site work well for different contexts - desktop browser to mobile device, etc. There are several articles on the site (just search for responsive web design you'll get several of his articles in your results.)

Categories