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

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:

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.

Chrome Extension launch from website button

I do have an extension (developed by me). It works fine. However I can't get the idea on how to launch extension from regular button on a web-page.
The main action (opens Chrome Popup) is performed when I click on extension icon.
But I also need to be able to launch extension via button click on website.
Should I send a msg to extension from website via javascript or?
Or I can go in a different way, and insert content from extension popup to website placeholder. A bit awkward working with extensions.
Any advice appreciated.
Thank you.
Unfortunately, it's not possible. But from the looks of it, it may be available soon.
Check out this answer in this thread.

Chrome extension: default pop_up vs injecting a div in page

I am getting confused understanding the practices generally followed in the popular chrome extensions. I am trying to develop my own chrome extension and after going through the basic tutorial, I have a default popup page that opens whenever I click the extension icon near my address bar. So far so good! While checking the source codes of some good extensions installed in my chrome browser, I came to know, none of them uses the default_popup page but definitely invokes some javascripts through either the background page or content scripts. But the final behaviour as seen by the user is functionally like a popup at the upper right corner of the screen, though more presentable. Is there any reason for not using default_popup over using other mechanisms?
I think it really depends on what your app needs in terms of functionality and design. As there are no real reasons why you might want to choose one over the other. Most information can be passed from the page to the extension app and vice versa. Users expect a popup when they click on the button but injected popups are also supported and commonly used in Chrome, Firefox and Safari.
Pros/Cons:
If your extension depends on the page content then you can inject scripts that analyze the page and inject divs accordingly. You can send analyzed data back to the extension and open a popup but thats an additional step. If your extension has nothing to do with the specific page then you would be better off using a popup.
Popups close when you switch tabs or your browser loses focus. Injected popups need not.
Don't inject scripts and stylesheets into pages willy nilly. They interfere with a website's native js/css and also stuff injected by other externsions which is near impossible to fully account for.

GoogleChrome-fullscreen issue

I tried with different options for automatically making a page full screen using javascript
I tried with the window.open("index.html","","fullscreen=yes,location=no, cursor=none");
I tried with the Native FullScreen JavaScript API- It only works on a button click or any other events , but I need to make the page automatically open on fullscreen.
...I need to make the page automatically open on fullscreen
You can't, and for good reason. That's why the fullscreen API (and window.open, typically) only works in response to a user event. It's by design to prevent web pages from hijacking the user's workspace.

WebView cocoa - Printing without a popup

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.

Categories