How can I request a desktop site from a Codename One Browser Component? - codenameone

I'm designing an app which has an embedded page on a form, using a BrowserComponent. Unfortunately the maintainer of the website recently created a very unfriendly "mobile friendly" version of the page and the user experience is much better with the desktop site.
Is there some way to get the BrowserComponent to request the desktop site?

You need to change the user agent to match the one of a desktop browser see Codename One - BrowserComponent: custom user-agent

Related

Responsive Website both mobile and phone, mingle both Reactjs and React native

I want to the responsive web app on Mobile and Web page. I have built a website on React js. I have brought that website using a web view to React native and made it a mobile app. Now I need to direct my users depending upon the platform. If they are mobile users I need to direct them to React native app(live on the browser) and if they use the system they should be seeing the website I build. How can I do that? Is it possible? Suggest me a better Idea.
You can achieve this using your backend code by checking request user agent if you get mobile, you can redirect to some other url (Probably play store).
You can do the same via front end JS also (not advisable). You can use these methods to detect if the user is on mobile, based on that redirect it to play store.
Check if the navigator userAgent is mobile or not. If mobile add a links to your app or app store to download it.
if (/Mobi|Android/i.test(navigator.userAgent)) {
// if I'm here that mean I'm a phone
}

Force stripe checkout modal on mobile?

I'm building a web app with Stripe checkout. On desktop it loads a nice modal when you go to pay, but on mobile it brings the users off to a Stripe page, and then back. I want it to look like the user is never leaving our site.
Is there a way to force the modal to be loaded on mobile? I'm building the web app in ionic at the same time, so if I want to turn it in to an app I can. Ionic uses a WebView on the phone and that loads the modal fine, so there must be some setting that is allowing it?
Anyone have any ideas? Thanks.
edit If I 'request desktop site' on my mobile it loads the modal fine
As Stripe makes these determinations based on the User-Agent you could try changing the User-Agent of your webview to match that of a desktop browser, (I did a similar thing except I needed to force mobile behavior in the desktop).
It should be stated, that this is definitely not recommended by Stripe nor supported and could break at any time. They'd recommend you just build a custom form using Stripe.js
How i can set User Agent in Cordova App has how to set the User-Agent in iOS and Android.

Azure Mobile App and AngularJS responsive in same host space

Is it possible to get ride of "This mobile app is up and running" page and when user enters the sitename redirect/route him to sitename/app folder where I can pretty much create a AngularJS website in my project folder. FYI - I'm a Dev beginner
using Custom site URL in Azure: I tried this and working pretty like,
when I open the site (www.testsite.com) it's taking me to blue screen
when I go to (www.testsite.com/app) it displays my AngularJS app that I am trying deploy along with and in same mobile app serivce
REST API services and details under www.testsite.com/swagger
why I am trying this ?
On a typical note I want my app to serve all devices, web, mobile, tablet and I feel that mobile app solution is the only lean solution to do rapid application development but wondering how to reach web users without creating an other Web App services in Azure only for Views or web client which comes with cost. let us say if mobile service is just a backend stack and it doesn't allow it... I wonder why not ? by doing it, developers don't need to create 2 services in azure (1. mobile app, 2. web app)
Appreciate it.
found work around by adding MVC Razor Home controller and view for home landing page. more information in this link. this may be a temp solution to get ride of Blue screen and I am going to explore more in include AngularJS site and routing from angular too.
Since this solution works with only MVC style routing there will be a conflict between routing mechanics. will update as soon as I get something.
https://social.msdn.microsoft.com/Forums/azure/en-US/f23175db-2a83-489f-ac0c-f2abe9e48a76/default-document-for-the-mobile-app?forum=azuremobile
If Home view not showing up refer this link.
The view 'Index' or its master was not found

IBM Worklight - Using native pages in a mobile web application

In worklight we can use native pages in a Hybrid application. Similarly I want to use the native pages in a the Mobile Web environment.
Is there any possibility to do this?
Short answer: No.
Longer answer:
WL.NativePage.show is available, as the documentation states, for Android and iOS.
Mobile Web environment - a webpage that is served, loaded, displayed, ... in the device's mobile browser app.
Hybrid app - an app that is comprised of a native shell and a WebView inside it, allowing the ability to open a native page... you do not have that in a browser.
There is no such thing in mobile web. Mobile web is a web site and not an application. However, you can leverage url schemas supported in iOS/Android. e.g. create an app that will declare myapp:// schema support and then add a link to your mobile web site, e.g. myapp://doAction1?param1=someparam
The application will start and process the URL. You can get a lot of info about it on the internet, e.g. http://wiki.akosma.com/IPhone_URL_Schemes

Facebook and share buttons on a mobile-enabled website that open the mobile app instead of a browser window?

One of the big flaws in Android webphones (and probably other Operating Systems for phones): You are surfing some website, and want to use the site's embedded share button for say Twitter. You want to use the embedded Twitter share because it pre-populates the tweet based on how the site designed it: namely, it has the title of the page and the link and maybe a relevant Twitter hashtag. If you were to use your mobile browser's share feature, you only get the link, and have to attempt to type in the title and guess relevant hashtags--not ideal. The same is the case with other social media shares, like facebook.
So, from the above, you understand why users would prefer to use a given website's own embedded share features, rather than that built into the mobile browser.
However, if a user clicks the site's embedded social media share button, it opens a new browser window for that social media. Ideally, this would not happen, as typical users do not log into these social tools using the mobile browser, and the resulting pop-up share is clunky to use on a small mobile screen. Instead, ideally, you would click on the site's embedded share button and it would attempt to open at least the official twitter (or whatever) app on your phone instead. This is ideal because users tend to use the apps to use their social media, and so would already be logged in. Moreover, such an app is obviously optimized for mobile use, and thus not as clunky.
And yet, this apparently does not exist... am I right?
That is, as a web designer, there is nothing I can do on my embedded Twitter and Facebook share buttons to prompt mobile phone users to use the official app to share (rather than through the mobile browser). Is that right?
Thanks,
Derek
At least on my iPhone the twitter url-scheme does work.
the following opens the twitter app:
twitter://post?message=hello%20world
And facebook is fb://
Haven't tested it on android.
(via: http://wiki.akosma.com/IPhone_URL_Schemes )
What about open a pop up box (not window)- when we click a link to share the URL site/page we are in, without have to go through the mobile browser ?
just a pop up box.
do you think it is possible? or any social media link would automatically opened in a browser?

Resources