Chrome extension change border-radius and position - google-chrome-extension

How can I add border-radius on chrome extension popup?
Also, can I add something like margin-top to the popup?

I got the answer from chromium developer:
Alas, that's not something you can control. Your popup content is
basically an iframe inside a window - you can't control the host
window

Chrome simply doesn't allow that.
Alternatives are, instead of the popup, opening a new window or injecting a content script in the active tab to display a modal.

Related

Is it possible to animate extension popup opening?

I developed a simple chrome extension. Following the answers in this SO post I was able to programmatically open the popup window on certain webpages. The default behavior of the popup is to open a window at the top right. Is it possible to modify this behavior? Ideally, I would like the popup window to slide in from the right after the automatic window.open is invoked in the background script.
No, you have no control over how and where it appears.
If you want something like slide-in, you're better off injecting your GUI elements into the page itself.
How feasible it is depends on whether you need to inject it into an arbitrary page or if you're working with just one specific website. Shadow DOM might help you isolate styles from the parent page.

Chrome extension Modal/Popup on click

I want to dynamically generate some buttons on my chrome extension default_popup HTML page and I want on click to open a model in the middle of the screen NOT a new tab, I saw some other extensions having its options like this, and then display some info.
I think the only possibility isto get rid of the defalt_popup and inject all my scripts through the background page straight into the html page.

How to open the default popup from context menu in a chrome extension

I have developed a chrome extension that opens a popup when I click on the icon near the address bar. Everything works fine, however I want to add some functionality to it. So I thought I'd also add a context menu item so that the user can simply search for the highlighted word. I want the popup to showup when the user clicks on the item in the context menu(the default popup in the top right corner and not a new popup window or a new tab).
Can I have this functionality? If yes, how do I implement it?
You can't make the popup page show programmatically as if the user clicked it.
However, you can still have something display based on the background script / content menu click. There are 4 main options for your background script:
Open a new tab to the popup.html page
Programmatic injection of javascript to construct a popup-like dialog on the page
Content script message passing to do the same as above, using a running content-script.
Use the notifications API for a simple minimally stylized message to the user.
Options 2, 3, 4 will allow the user to stay on their tab without any navigation. The notifications API route is the simplest to use if you just want some quick notification to the user, and there are fewer security snags. 2 and 3 require more book-keeping, but you can make the dialog look like your popup.
There should be an API for it now (as in 2023)
https://developer.chrome.com/docs/extensions/reference/action/#method-openPopup
update: tried, but failed, there was a bug.
https://github.com/GoogleChrome/developer.chrome.com/issues/2602
hope they fix it soon.
I was looking for extensions that I have already been used, but forget its name. This extension opened up the result into Context Menu, without open new TAB or popup.
may be useful
https://developer.chrome.com/extensions/contextMenus

Chrome: How to close tab from within a page?

Is there a way to close Chrome Tab from within a html page?
What i search for is some javascript that will will say: Click here to close tab!
I think you can just use the window.close() function, just like you would when closing a popup window or a regular window:
http://www.javascript-coder.com/window-popup/javascript-window-close.phtml
Update: This no longer seems to work on newer versions of Chrome. However, opening a new window with:
Open window
and using
Close window
in foo.html works for me in Chrome 17. See also http://www.google.com/support/forum/p/Chrome/thread?tid=23c03746e3aa03f9&hl=en.

How to open new window without titlebar in javascript

How to open new window without titlebar.
You can't (thankfully), at least not in common browsers in a standard web security context.
Every window opened by Javascript will have a titlebar. You only have control over whether scrollbars, statusbars, and toolbars are present in the opened window.
To get a headless "pop-up" effect, look into a library like LightBox that can do these sort of effects. You're not actually opening a new window according to the user-agent, but the behaviour is similar.

Resources