WebView cocoa - Printing without a popup - javascript

I'm developing an OSX application that displays a web view as a part of the application. Inside the web view, there's a button that lets the users print out the page that they're currently on. When the html is opened in safari and the button is clicked, there's a popup asking the user to select the print settings for that file. However, this popup isn't showing at all when the page is opened in the web view. Is there some way (tweak to the javascript maybe?) that lets me print to the default printer with the default settings without showing this popup at all?
Thanks,
Teja

The print dialog and handling are implemented in the hosting application.
See -webView:printFrameView: in the informal WebUIDelegate protocol for details.

Related

How to open a browser app which is listed in chrome://apps

Chromium-based browser has the apps page at chrome://apps
There are some apps that I have installed into it. Is it able to launch one of them from JavaScript somewhat just like opening file selecting box?
I can open chrome://apps by setting this URL in to a link, but how about a single app?
Copied from: Open Chrome in a new window (Chrome app)
Sadly, there's no way to do that I know of.
Using window.open in an app's context is a bit of a hack, but results in the URL being open in the user's default browser (not necessarily Chrome). There's no control as to how the browser chooses to open it.
There's a Chrome App-specific API that was created specifically with "open a page in Chrome" in mind, chrome.browser. However, it still doesn't provide an option to open in a new window.
The closest you can get is to create your own "browser": an app window with an in it. Then you have full control over the presentation, but it's not integrated with Chrome's profile and may require additional work to implement things like dialogs and browser controls. See the Browser sample app and documentation.
You may need the app id which you can then append to the URL. I am not entirely sure how you would find but if you go to the apps page on chrome, drag the icon of the app to the search bar in the browser, you should get the full link.
For instance, I dragged the Google Slides Icon onto the search bar and it gave me this url chrome-extension://aapocclcgogkmnckokdopfmhonfmgoek/main.html. So, you may give it a shot! Try to open the chrome apps page, then drag the app you want to open in new tab onto the search bar.
Hence, using Javascript:
window.open("chrome-extension://aapocclcgogkmnckokdopfmhonfmgoek/main.html", "_blank");
Opens Google Slides App in a new tab.

How to open a file directly from msSaveOrOpenBlob?

I am using IE 11 for web development. Now in javascript, I do window.msSaveOrOpenBlob(fileBlob), a pop up shows on the button of the page with save and open option.
Now what I want to achieve is that perform click event on open so the file will be open automatically(without user click open).
Here is the case:
User click a link, it should open the associated file with whatever file reader that can open the file. PDF, will be adobe reader, word document will be opened in microsoft word.
Things still works when I click the open button from pop up. I just want to skip this manual click and do it in the code.
I've seen some webpage does this, but can't figure out myself. Need some help.
As far as I know, we can't control the "open or save" prompt using JavaScript. It is the browser behavior.
As a workaround, to the pdf file, I suggest you could try to use the pdf.js plugin to display the pdf file. To the Office documents, you could check the following article to use the Office Web Viewer to view the document.
Office Web Viewer: View Office documents in a browser
Besides, here is an article about displaying (Show) Word, Excel, PowerPoint (PPT) and PDF files in browser web page in ASP.Net, you can also refer to it.

show web page in web browser using phantomJS

Is it possible to show page in web browser (for example in Chrome or Firefox) using phantomJS? I mean, I go on web site, fill in login and password fields and click OK button. After that new page is loading. I want to show this new page in web browser. Is it possible to do with phantomJS? If yes - please, tell me how to do it. If no - please, tell me what should I try to use (I need in hidden mode do some things on web pages (fill in forms, click buttons) and finally show the result in web browser).
I'll appreciate any help.

Chrome Extension: adding button to header-title area of tabs

I want to develop extension that can reload a web page by clicking on the tub.
Is it possible to add a button to the title area of a web page?
If yes
What should I add to the manifest?
Which object should I use to do so?
Unfortunately, this is not possible. The Google Chrome Extension APIs do not provide any functionality to do this... yet. As of now, your extension can only display page actions on the address bar or browser actions near it along with other extensions.
Page actions:
Browser actions:

iFrame - prevent link to open in new window

I have a WPF application with a WebBrowser control that run a web application that will be displayed in full screen.
In the application, I have a iFrame used to display an other website (could be any website...). But I would like to prevent this website to open a new window when a link is clicked and prevent any dialog window to appear.
Is there a way to do it ? I have no control on these websites source code...

Categories