HTML Style Tag in Android - html

As I have referred some articles and sites, I found that we can also create HTML file and then we can display HTML file using Android WebView..
I have referred at:
Android WebView (WebKit) Tutorial
Understanding User Interface in Android - Part 4: Even More Views
So my question is that:
Is Android provides STYLE/CSS tag to define styles, if yes then there is any way to write STYLE/CSS tag in Android?
Thanx - Paresh

Of course. The Android Web View is a full fledged browser, and supports everything the built in "Browser" application supports (CSS, JavaScript). Newer versions of Android (2.2) have the V8 runtime and do great on the Acid tests.
You would use CSS as you do in any other web page.

Related

How do I get rid of the sidebar and toolbar when embedding a pdf in an html file?

Trying to embed a pdf on my website like so:
<iframe src="filename.pdf" type='application/pdf' frameborder="0"></iframe>
The website is a rails site, and currently I'm only running it on a local server.
The problem is that the pdfs render with a toolbar on top and a sidebar with my adobe creative cloud account information, as seen in the picture below (the actual content of the pdf displays in the white box under the toolbar and to the left of the sidebar)
How can I get the pdf to render alone, without the menu and sidebar?
If you allow the browser to choose how the PDF gets rendered, you're never going to be able to create a consistent experience for your users unless you are in a controlled desktop environment.
If you are looking for a consistent experience, use pdf.js to render the PDF in the browser.
If you are in a controlled environment and all of your users have a browser/viewer combination that will let the browser show PDF using the Adobe Reader plugin (as your screen shot shows) then you can use the "open parameters" at the end of the URL to control what gets shown. See the documentation at the link below.
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf
That said, don't count on that solution to work for very long. Most modern browsers are not allowing the viewer plugins to function anymore and the rest are moving in that direction.
Searching more into stack, try that:
https://stackoverflow.com/a/2105095/7741129
For more detailed informations:
http://blogs.adobe.com/pdfdevjunkie/web_designers_guide
I think it's better use some kind of JS stuff just in case of cross-browser issues, like related into first link. Solutions like https://pdfobject.com/ it's helpful to get the job done. Look:
PDFObject 2.0 detects browser support for inline/embedded PDFs. (In
case you were wondering, your browser supports embedded PDFs. You
lucky dog, you!)
If you're working with dynamic HTML, such as a single-page web app,
you may need to insert PDFs on-the-fly. However, PDF embedding is not
supported by certain browsers. If you insert markup without first
checking for PDF support, you could wind up with missing content or a
broken UI.
The PDFObject utility helps you avoid these situations by detecting
support for PDF embedding in the browser; if embedding is supported,
the PDF is embedded. If embedding is NOT supported by the browser, the
PDF will NOT be embedded.
By default, PDFObject 2.0 inserts a fallback link to the PDF when the
browser does not support inline PDFs. This ensures your users always
have access to your PDF, and is designed to help you write less code.
The fallback link can be customized, or the option can be disabled if
you prefer.
PDFObject 2.0 is npm-ready. Modern web apps use npm to manage packages
and dependencies. PDFObject 2.0 is registered with Node Package
Manager (npm) and can be loaded dynamically.
PDFObject also makes it easy to specify Adobe's proprietary "PDF Open
Parameters". (Be warned these parameters are only supported by Adobe
Reader, most PDF readers will ignore the parameters, including the
built-in PDF readers in Chrome, Internet Explorer, and Safari. Read
more below.)

html5 web app manifest boilerplate?

Is there a boilerplate for html5 web apps?
Safari for example, has specific guidelines on manifests in order to make a web site into an app, Firefox also has similar guidelines, as does chrome.
Is there any boilerplate for quickly starting an html5 webapp?
You can refer to Google's Web Starter Kit: https://github.com/google/web-starter-kit/blob/master/app/manifest.json
There's also a generator at: https://tomitm.github.io/appmanifest/
There's also a validator at: http://manifest-validator.appspot.com/
https://html5boilerplate.com
Mobile Boilerplate helps you create rich, performant, and modern
mobile web apps. Kick-start your project with dozens of mobile
optimizations and helpers.

Difference between jQuery Mobile and PhoneGap

jQuery Mobile and PhoneGap both appear to be targeting cross-browser mobile development based on HTML5, but what are the major differences between the two?
What are the Pros and Cons of each framework?
Why would you choose one over the over?
Simply put jQuery Mobile is a UI toolkit for building mobile web applicaitons.
PhoneGap is a JavaScript framework which allows you to access native device functionality like the camera, contacts, file system, etc. PhoneGap does not provide UI elements.
If you want to create a hybrid mobile app, one which is built using HTML5 but runs on a device like a native app, you would not choose one over the other. You'd use both.
JQuery mobile is a javascript library for mobile broswing (mostly adapt the user-interface for better user experience on mobile devices)
Phonegap is a cross-platform development framework that provides core mobile device features to web-based mobile apps (Extracted from here)
Basically, you cannot use phonegape to take pictures from a website, but you can build an app with HTML and javascript (Phonegap) that access to some features in the mobile.
By the way you can use both in the same application: link
JQM is just a javascript framework, gives you some UI controls, animations and manages page navigation for you.
It's still a javascript webpage, so you don't actually have anything compiled in the end. Because of this your users access it using their BROWSER pointing to a URL, just like a normal website (only those are called Web-Apps in iOS language).
PhoneGap is just a Native project (written for all major Mobile hardware, like iOS, Android, BB, WP7, etc...) that wraps a WebView control (basically a browser window) inside an app. You could include your .js/.html files, and those would be loaded LOCALLY. Another feature of PhoneGap is a jscript bridge between your code and the phone's native capabilities (like for example taking a picture from javascript!).
You end up with a NATIVE APPLICATION that you can then post to the AppStore/AndroidMarket.
Hope this helps clarifying the difference.
The jQuery Mobile documentation has a page about making an app with PhoneGap and jQuery Mobile: http://jquerymobile.com/demos/1.0/docs/pages/phonegap.html

How to make an HTML5 that does not require the blackberry browser component?

I used the latest and greatest jQuery Mobile (RC1) to develop an app for the client. I used the latest Webworks version from RIM and packaged the app in a Cod file.
The app works great if accessed through the web browser ETC however when I installed the actual generated JAD/Cod files onto a blackberry device, performance was horrible even with minimum number of jQuery libraries.
Since I have Googled this everywhere and it is apparent that one cannot have a meaningful app experience if Webworks is used, I want to be able to just create something that just places the app icon on the phone. Once clicked, it open the browser and takes the user to the web server where the HTML files are parked.
Is this possible?
You can do that, with a very simple Java-application.
The following code:
Browser.getDefaultSession().displayPage("http://www.yourserver.com");
It will open browser and open page: http://www.yourserver.com
Browser class javadoc is here: http://www.blackberry.com/developers/docs/5.0.0api/net/rim/blackberry/api/browser/Browser.html

Plain Html and javascript execution offline

Can HTML and javascript run offline like an application? I'm looking to running the webpage offline like silverlight OOB applications. But if the browser closes, I want some way to run the webpage again without going online. Is this possible?
The HTML 5 draft introduces mechanisms for a webpage to be used as an offline application although, obviously, as a recent draft spec this isn't supported by all browsers.
You can also File > Save As and just save an HTML file and its associated JS locally.
Google Gears provides the kind of functionality that you're looking for. Google themselves are planning on phasing it out in favour of HTML5's draft (see David's response) but I think you will find Gears more mature [for the time being, at least], and (perhaps importantly, if you're considering redistribution) more consistent across different browsers.
[Further edit:] The Adobe AIR runtime allows you to run HTML and JavaScript applications on the desktop.