Trusted Web Activity & Bubblewrap forcing the render engine (Chromium/firefox/geko) - chrome-custom-tabs

Is there a way with bubblewrap when building a TWA to force the #custom-tabs engine that is used? Ie at the moment if a user has their default browser set as Firefox the TWA installed will use the Firefox/gecko implementation...
I'd rather force TWA to use chromium #custom-tabs due to additional APIs available and CSS handling..
Additionally testing is far easier with one engine than two.
Thanks

Bubblewrap doesn't provide an option to always use a specific provider. That is by design, for two reasons:
it's not possible to guarantee that a given browser will be installed for all users.
favour the user's browser choice.
It is possible to modify the app directly to get this behaviour, but due to the reasons above, not recommended.

Related

Drupal, set dynamically css

Does anyone know how to set dynamical css in a Drupal 7 theme? Depending on the browser I want to choose one or another file.
Thanks a lot!
Take a look at the Browser class module, and the Browscap module. These projects will lead to a result that does what you want.
This small module helps theme-developers to deal with cross-browser compatibility. It makes easier to handle different types of non-widespread browsers just as much as it helps with using different versions of Internet Explorer.
The module extends the $body_classes variable in page.tpl.php based on the enduser's browser, and platform.
Browscap provides an improved version of PHP's get_browser() function.
The get_browser() function can be used to tell what a visitor's browser is capable of. Unfortunately, the version provided by PHP has a number of limitations, namely:
It can be difficult or impossible to configure for shared hosting environments.
The data used to identify browsers and determine their capabilities requires consistent maintenance to keep up-to-date.
Browscap automates maintenance by storing browser data in a database and automatically retrieving the latest data on a configurable schedule.

How can I detect the device from which my website is accessed?

I have .NET website that is mainly built for desktop browsers but I'm currently making a mobile version of it. What I'm trying to do is load the website according to the device on which it is accessed by the user. Is there a way that I can get information about the user's device when they request the site?
Regards,
Sumit.
As suggested by others you can use the System.Web.HttpBrowserCapabilities class accessible through Request.Browser however without updated browser definition files the information is completely worthless.
For example, if you use Request.Browser.IsMobileDevice this should give you what you want, but is based on a set of very dated regular expressions in your .NET framework folders in Windows.
You can see the kind of problems that can be encountered on a (currently unanswered and unloved) post here on Stack Overflow.
If you do not plan on keeping the browser definition files up to date (which is no small task) then quite simply do not go down this route.
If you simply want to know whether the user is viewing on a mobile device then here are a few options:
Detect Mobile Browsers
51Degrees.mobi
WURFL
User Agent Info
Some of those are free, some aren't and if you are really only interested in whether it is a mobile device, my recommendation would be to use Detect Mobile Browsers.
Take a look at the HttpBrowserCapabilities class.
Enables the server to gather information on the capabilities of the browser that is running on the client.
This is actually exposed on the Request property of the Page object - in an ASP.NET page you can do the following:
var browserCap = this.Request.Browser;
You can examine the HttpRequest.Browser property - MSDN link.
If you are looking for something more low level: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.useragent(v=vs.90).aspx
A commercial alernative is BrowserHawk

Hp Touchpad Browser ASP.NET thinks that cookies disabled

Just bought a cheap defunct hp touchpad. I notice that when I browse to my asp.net web app the url returns session id. The touchpad has cookies enabled and my web.config contains no mention of 'cookieless' which I would have thought would default to "false". IOW This should not be happening. And I have not seen this behavior with any other Browsers I have used on this particular web app.
Is there some other reason that would result in the session id being embedded in the url for this browser?
Edit
Ok i just noticed that, although cookies are enabled for the browser (and visits to 'Browser capability' online sites back this up), ASP.NET's HttpBrowserCapabilities.Cookies is set to false.
Sounds like the default ASP.NET browser capabilities detection doesn't handle WebOS browser.
Microsoft has given up updating the browser capabilities actually, but you can have similar functionality from Wireless Universal Resource File (WURFL) project:
http://wurfl.sourceforge.net/dotNet/ (powered with sample code)
The current officially recommended way to make use of this data is through a library called 51Degrees.mobi http://51degrees.codeplex.com/
I say officially recommended as per:
http://www.asp.net/learn/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application
which is one of the most complete references for dealing with mobile devices in general, and is part of:
http://www.asp.net/mobile
Check it for more documentation.
There are other alternatives as well like:
http://blog.mobileesp.com/?page_id=53
which gives you general classes of devices. You'd be checking for WebOSTablet instead of cookies support, so, it's helpful more in device specific optimizations than for general capabilities detection.
But you probably want to try the WURFL project API or the 51Degree.mobi API for the detection.

How to make two web sites appear as one - What features are important?

I am about to write a tender. The solution might be a PHP based CMS. Later I might want to integrate an ASP.NET framework and make it look like one site.
What features would make this relatively easy.
Would OpenId and similar make a difference?
In the PHP world Joomla is supposed to be more integrative than Druapal. What are the important differences here?
Are there spesific frameworks in ASP.NET, Python or Ruby that are more open to integration than others?
The most important thing is going to be putting as much of the look-and-feel in a format that can be shared by any platforms. That means you should develop a standard set of CSS files and (X)HTML files which can be imported (or directly presented) in any of those platform options. Think about it as writing a dynamic library that can be loaded by different programs.
Using OpenID for authentication, if all of your platform options support it, would be nice, but remember that each platform is going to require additional user metadata be stored for each user (preferences, last login, permissions/roles, etc) which you'll still have to wrangle between them. OpenID only solves the authentication problem, not the authorization or preferences problems.
Lastly, since there are so many options, I would stick to cross-platform solutions. That will leave you the most options going forward. There's no compelling advantage IMHO to using ASP.NET if there's a chance you may one day integrate with other systems or move to another system.
I think that most important thing is to choose the right server. The server needs to have adequate modules. Apache would be good choice as it supports all that you want, including mod_aspnet (which I didn't test, but many people say it works).
If you think asp.net integration is certanly going to come, I would choose Windows as OS as it will certanly be easier.
You could also install reverse proxy that would decide which server to render content based on request - if user request aspx page, proxy will connect to the IIS and windoze page, if it asks for php it can connect to other server. The problem with this approach is shared memory & state, which could be solved with carefull design to support this - like shared database holding all state information and model data....
OpenID doesn't make a difference - there are libs for any framework you choose.

Mobile device is detected as non mobile device

I've included a mobile web form in my asp.net project, I thought that it could/should be seen just for my mobile users but I realize that it can also be seen from any browser, I don't see problem there cause I could diff the access using HttpBrowserCapabilities.IsMobileDevice=true and transferring to the appropiate aspx page, but it results that when I access to the web form from my mobile device it is identified as IsMobileDevice = false and sends me to another page.
How could it be possible that?
The mobile device runs Pocket PC 2003.
IMHO: The value of HttpContext.Current.Request.Headers("User-Agent") is a much safer bet as it actually indicates the browser that is making the request, and not the type of device per-se.
I've learnt from experience that if a smart phone makes a request through a third-party browser to your service, more-often-than-not any sort of "what type of device are you" test (HttpCapabilitiesBase.IsMobileDevice and/or HttpContext.Current.Request.Browser.IsMobileDevice) will fail.
Unfortunately though, short of a big list of allowed user-agents (or disallowed user-agents for that matter), you'll just have to make sure it doesn't start with Mozilla, iPhone or Opera before you render the page...
It's a hard arena to play in.
Good luck.
Some are not recognized, because the UserAgent has been messed with or a new browser is being used. Such as Opera Mobile 9.5. To fix this you need to create a Browser (*.browser) file specifically for defining this. I had to do it for the new Mozilla based UserAgent that is being sent from Google.
I think you should use other DDR better than Microsoft Browser Capabilities. I´m using http://wurfl.sourceforge.net>WURFL, it is open source and maybe it is more extended and updated. There is other commercial DDRs like DeviceAtlas.
There is many some .net libraries but i´m using Marg.Wurfl. It allows to rendering web mobile page using wurfl capabilities.

Resources