Detecting mobile device from static HTML page on Windows server - windows

I need to implement mobile device detection on a static HTML website. JavaScript isn't an option since many devices have it disabled or don't support it. The site is on a Windows server and as I normally work with a LAMP stack I'm not sure what my options are. Any help would be much appreciated, thanks!

I think it's depends on what do you expect to do after the detection. If you you only want to change the style of your HTML page, you can just add different CSS files in your HTML header section.
<link rel="stylesheet" type="text/css" media="screen" href="screen.css" />
<link rel="stylesheet" type="text/css" media="handheld" href="mobile.css" />
The first line will applied screen.css to your web page when user browse with standard monitor. The second line will be applied when browsing with a mobile device.
Other than simple style changes, I don't think you can do too much on static HTML.

Related

Mixed content google chrome, cant find the source

Im developing a golang webpage and am running into some troubles when deploying my page to google app engine (appspot.com). This is because Im running it using http when developing on my machine, but over https when deployed.
Google chrome doesnt like this so it blocks the content trying to be loaded over http. Im fine with this since I like security. But I cant find the source.
All my includes are https or //, or just local files.
Here is a image of the error in chrome.
This is some includes that I use. Maybe some of them is loading a font?
<link href="/static/css/googlefont.css" rel='stylesheet' type='text/css'>
<link href="/static/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="/static/css/style.css" rel="stylesheet" type="text/css">
<link href="/static/css/sweetalert2.css" rel="stylesheet" type="text/css">
<link href="/static/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="/static/css/modal.css" rel="stylesheet" type="text/css">
<script src="/static/js/jquery.js"></script>
<!--<script src="/static/js/jquery.min.js"></script>-->
<script src="/static/js/register.js"></script>
<script src="/static/js/login.js"></script>
<script src="/static/js/sweetalert2.min.js"></script> <!-- Sweetalert -->
<script src="/static/js/spin.min.js"></script> <!-- ?? -->
<script src="/static/js/bootstrap.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="/static/js/jquery.cookie.js"></script>
<script src="/static/js/stuff.js"></script>
<script src="/static/js/flat-ui.min.js"></script>
<script src="/static/js/application.js"></script>
<script src="/static/js/bootbox.js"></script>
I cant seem to find the source..?
Thankful for any help in the right direction, i'm going crazy here..
Check all the CSS stylesheets your document is loading, including any CSS stylesheets that are getting loaded through an #import. In one of the CSS stylesheets, you most likely have a rule with a url(…) call something like this:
src: local('PT Sans'), local('PTSans-Regular'), url(http://fonts.gstatic.com/s/ptsans/v8/fhNmDCnjccoUYyU4ZASaLVKPGs1ZzpMvnHX-7fPOuAc.woff2) format('woff2');
Use the Network tab (or equivalent) in your browser devtools to get a view of all the resources your document is loading. You can sort that resource view by type. So, set it to sort by type and then look through the source of all the type=stylesheet or type=css resources to see which one has a url(…) that uses an insecure http scheme.
If someone hasn't already, there really should be a feature request lodged with Google. The fact that Chrome knows the location of the error but just displays "(index):1" in the developer console just doesn't cut it.
In the meanwhile, the easiest way to find the offending CSS in Chrome (ver 68) is to "Customize and control DevTools" by clicking on the 3 dots in the top right corner of the development console and clicking "Search" ) or "Ctrl+Shift+S". You might have to drag up the horizontal pane at the bottom of the screen.

Bootstrap doesn't work in Firefox browser

I have a Bootstrap form made, but it doesn't appear correctly in Firefox... All other browsers seem to work. I've tried everything!
Here's the link: http://www.redmandesign.ie/bootstrap/form1.html
I think it's related to the bootstrap style sheet but I'm not sure.
Can anyone help, I'm really stuck!!!
<link href="css\bootstrap.css" rel="stylesheet">
<link href="css\bootstrap-responsive.css" rel="stylesheet">
Should be changed to:
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
Explanation: Firefox is sending a request for a file called css\bootstrap.css instead of asking for bootstrap.css in the css folder, which doesn't exist and the server replies with a 404 error. Don't you just love the subtle difference between the types of slashes? :P
In firefox , when you check for this link https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css. It shows this connection is untrusted. Accept it and Procced it from the browser. Now run the bootstrap file, it should work.

bootstrap fixed-width vs fluid-width in mobile and broswer

In the bootstrap application, what layout best suit both mobile and browser user interface? fixed-width layout or fluid-width layout? Do I need explicitly define the css media query styles for both design?
You may use Bootstrap's responsive deisgn by which your website will automatically adjust itself in order to give users a comfortable experience for whatever size device they’re using..
For it's application you need to include meta viewport tag under your <head>..</head> tags in addition to including Bootstrap’s responsive stylesheet
<head>
..
<meta name="viewport" content="width=device-width, initial-scale=1.0">
..
<link rel="stylesheet" href="responsive.css" />
..
</head>
You may check further details here and also this article
So, If you have correctly setup your page with containers, rows, and spans, Bootstrap will automatically adjust the layout for each device you are viewing the website on..

How do you switch _layout.cshtml based on Screen vs Handheld? (.NET MVC3)

I am designing a small website that I want to be able to browse both on a computer as well as a mobile device. I understand that I can swap out my CSS fairly easily for most mobile devices using the following:
<link rel="stylesheet" type="text/css" media="handheld" href="foo_mobile.css">
<link rel="stylesheet" type="text/css" media="screen" href="foo_screen.css">
However, what I really want to accomplish is swapping out the _layout.cshtml based on browser type (screen vs handheld - plus iPhone).
I've seen plenty of sites that redirect mobile devices to a sub-domain like m.xyzCorp.com but would like to avoid that if possible.
Is there any sample code or tutorials out there? my Google-foo is weak today.
TIA
In _ViewStart.cshtml have something like this
#{
if (!Request.Browser.IsMobileDevice)
{
Layout = "~/Views/Shared/_Layout.cshtml";
}
else
{
Layout = "~/Views/Shared/_MobileSiteLayout.cshtml";
}
}

Printing web fonts in Firefox

I am trying to print web pages that contain external CSS references and use web fonts (I mean #font-face attribute) but in print preview the web fonts disappear. Does anyone know a solution without using the web font locally?
Looks like printing #font-face fonts is not yet implemented:
https://bugzilla.mozilla.org/show_bug.cgi?id=468568
Works as of Firefox 18! - Yippee!
inlcude the file not only for screen but also for print
<link rel="stylesheet" type="text/css" href="main.css" media="screen" />
but include the css also for print
<link rel="stylesheet" type="text/css" href="main.css" media="print" />
in your case the href should then go to an external url

Resources