Javascript printing on mobile devices(ios) - javascript

I have to add Print button to my site. I used tyical window.print() solution.
But this method doesn't work in chrome and atomic browser on ios7 but works in safari.
How should I implement this feature?

Check this out: http://www.printfriendly.com/browser_tool
You can integrate their javascript to your web page so that your users can either print directly or print as a pdf. IMHO the window.print() is useless on an iPad or iPhone unless you have a wireless printer nearby. Most of the cases you wont have one nearby. The option above is promising because i can save it to iBooks or Adobe Reader and later print or send it as an email - That's usable.

Related

How to open html hyperlink from Chrome / Edge to IE?

How to open link from Chrome / Edge to IE only?
I know about security issue but my higher ups still wants to do this and its not up to me. All our website stored inside a local data warehouse in office and our website/applications doesn't show up on google. Only staff have local access to these applications
I want to open following folder using HTML or VB.NET or js
Server/Public/websiteFoldeer/Document
Google Chrome blocks this feature so my work around was to simple re-direct link to IE web browser which doesnt block this feature
<a href="file://Server/Public/websiteFoldeer/Document"/>
now for some reason above link is opening in Microsoft Edge, which does block this feature
if there is a better work around please let me know.
As you will no doubt hear, this is a very bad idea. With that said, as you discovered, the url is opening with the default web browser. If you need it to open in Internet Explorer, you'll have to call the "iexplore.exe" and pass the url as a parameter.
You will have to use something like:
<a href="javascript:exec('C:\Program Files\Internet Explorer\iexplore.exe', "file://Server/Public/websiteFoldeer/Document");"/>

Is there any way to force a link to open in Chrome from Facebook's in-app browser?

I've got a web app that requires the ability to print. Facebook's in-app implementation of Chrome doesn't allow printing. Currently, I'm giving the user instructions on how to open in chrome themselves in place of the print button I give normal users. But I'd prefer to just open Chrome for them when they get to that page, or at the very least provide a button/link that would open the page in Chrome instead of forcing them to find the settings button and figure out how to open Chrome themselves.
I've tried using the googlechrome://myurl.com approach, and Chrome opens, but the specified url doesn't load.
I've looked into Google's Intent option but I wasn't able to figure out how to open Chrome with that method.
Is there a way to accomplish this in javascript? or by some url scheme in an href attribute?
So far, all the other answers I've found give explanations for how to do this from an Android App, but not from a website.
** Update: The googlechrome://myurl.com seems to work fine from iOS in the native facebook app. It does not appear to work correctly using the native facebook app in Android.
Try
googlechrome://navigate?url=example.com
for Android users.
Reference from https://stackoverflow.com/a/12013755/9514189

Print web page (HTML 5 canvas) without printer prompt

I'm able to print HTML5 Canvas content. But every time when I click print a window prompts to select printer and settings.
How to make silent printing? I need the browser to print in default printer without prompt.
I need the solution for IE 10 and later, Edge and Chrome.
From a web application you cannot access resources on local machine like file system or installed applications. If you need this capability in your web application, you need to develop some browser plugin which can do this job.
This won't work as granting the web page access to printing without a prompt would be a security problem.
There may however be an option (flag) for disabeling the printing dialog in your browser. But this would affect all websites viewed in this browser.

Google+ JavaScript API Login Popup not returning Chrome on iOS

I am using the Google+ Javascript API log in button and it works perfectly fine in Chrome on Windows and Android. It also works perfectly fine in Safari on an iPad and iPhone. However, when using Chrome on the iPad or iPhone, the pop-up tab for the Google log in never returns after clicking to allow access. It seems to be submitting the form to the pop-up tab and never directing back to the original tab. Any ideas?
Google knows about this issue, but currently cannot do anything about it. It comes down to window.open not working in UIWebview.
Safari is not limited by App Store rules the way all third-party apps
are. Apple can use any WebKit APIs they want to, whereas we are
constrained to what is possible using UIWebView.
They encourage anyone facing this issue to open a bug with Apple.
You can't make Apple do anything, but anyone affected by this can
file a bug against Apple about the fact that UIWebView doesn't support
window.open and subsequent cross-site scripting, to clearly
communicate demand for that support.
There's no way for people to add votes or comments to existing Apple
bug reports, so the usual advice is for everyone to file their own.
Here's the URL for bug reporting in Apple: https://bugreport.apple.com
Here is a sample bug posting to Apple provided by one of the users:
Summary: Please add support for window.open and subsequent cross-site
scripting to UIWebView. This is blocking Facebook/Twitter/etc login
workflows in Chrome for iOS for example
Steps to Reproduce:
1. In a tab, open a page that runs the code var w = window.open(yourURL, null, null);
2. The page at yourURL should try to accesswindow.opener`, such as to postMessage back to the original page
3. Don't profit.
Expected Results: New window can access window.opener.
Actual Results: window.opener is undefined.
Version:
7.0.4
Notes:
Configuration: Chrome Version (from "Settings > About Google Chrome"):
19.0.1084.60 Device Type: iPad 3
You can follow the issue thread for updates.

Print Web page on 4 inch printer from mobile

I am developing a mobile web application. On the form when the user press Print button I need to print the page on a 4 inch printer.
My question is how can I connect to the printer from the mobile web browser(may be using bluetooth, USB).
My application will be running on all type of smart phones(Andriod , IOS, Windows, BB etc).
Unfortunately android and ios lack the concept of a printer driver so there is no native and widely supported way to print from mobile devices.
However there are a couple of other options to consider:
Rely on the user to have an app installed for their preferred printer (this probably is not a satisfactory solution as these apps often integrate poorly with mobile web browsers)
Target the (fairly common) printers which support email printing, that is allow the users to enter the email address for their printer and then send an email to that address containing whatever it is that you wish to print (for anything other than plaintext you will need to send a multipart email with html content)
The easiest thing to do is use a service like Google Cloud Print.
Once the user has completed the action on the app (iPhone, Android, BB) or web browser, you can then submit the data to a printer of your choice. There is full documentation available.
Unfortunately not all the printers are supported by Android.
But if you have a back-end, get a wifi printer and print it using the wifi-printing preferences from the back-end, trigger of course is from the mobile.
This seems like a better fit:
Use a print server - a separate computer that accepts simple printing messages from your app. The print server can house the drivers for the printer and take care of rendering. You can write a small service application to listen for jobs from the app.
Android wasn't designed to talk to printers.
try iprintmarvel printer it is very easy to integrate with android/java mobiles
Use javascript to print the page from browser, but your phone must be connected to a printer.
Just try this line of code on any button click event.
window.print();

Categories