chrome desktop notifications get text - google-chrome-extension

I have chrome plugin, that checks given URL and use 'get' method to check the return HTML code. if thee are errors - chrome notifications will pop. I want to create a button and whenever the notification button will be clicked, an alert will pop with the notification text.
I am not able to find any source of information on how to do this, and I will be happy if someone can help me with this
I've already try to search examples, on the web and on Google's website but without any luck

Related

is it possible to show toast in google chrome extension v3

I want to show some message when use use the google chrome extension plugin, I am using alert to show message like this:
alert("success");
this work fine but need to click close by the user. I want to show some message like some notification and tell use success, but the user did not need do any operate. I have know the chrome notification but it need user to allow the notification. any other way to do some toast in google chrome extension v3?

How can I use links in Slack which deep link back into my Slack bot?

I have a Slack bot that, in response to a /command - a search query - can display a list of matched database entries. I would like to present this list as a clickable link + short summary for each of the DB entries (using blocks).
Example:
Clicking the link for any entry should tell the Slack bot to display the full database record as a new Slack message.
I can't figure out how to get a link to do anything other than open the browser. None of the options for deep linking, or linking to a bot mention appear to be suitable.
Can anyone think of a solution for this? I would prefer not to give each list entry a button or accessory to 'open' the link.
already tried :
Each item as an https:// link to the node app behind the bot, passing the title to be displayed. This works but opens a browser window in the interim.
Mentioning the bot in a link <#ABOTID>Title to open
You can only deep link to existing messages, but not use links the same way you can use buttons.
You could of course link directly to your app, but that would always also open the browser, which as you say you don't want.
So for blocks you are left with the option you already mentioned: putting a button next to each entry in the form of a Section with a button.
An alternative would be to use Secondary Attachments. Those are automatically collapsed for longer text and the user gets a button he can click to expand them.

Is it possible to put links in chrome desktop notifications

I'm making a chrome extension which displays desktop notifications on particular events. I am receiving and displaying the desktop notifications just fine, but the problem comes when I try to put attribute tags into notification. Instead of being the text as tags to be appended to the notififcation's DOM, Chrome seems to just interpret them as plaintext, resulting in the content of the notification being just html source code.
Is there any way that I can have the body of my messages be appended as HTML instead of just text or am I just out of luck?
It used to be possible, but now it's not. But you could use a "Rich Notification" and put the link on a button. See https://stackoverflow.com/a/13328513/488287 for details.

Calling chrome.browserAction.setIcon from content script the way it is done in background script

I am making an extension for chrome. It fetches data from webpages and emails it via local email client. I have a toolbar button which user has to click to invoke the script.
My script works for a few selected urls. I want my toolbar button to change icon based on whether the url is among our list or not. For example for site1 it should be redicon.png and for site2 it should be blueicon.png. I can change button icon using chrome.browserAction.setIcon. But the problem is that this API does not work in content script. It works fine in the background.js file but not in content.js. Kindly tell me how to achieve this.
I know using pageAction instead would do the trick but my client requirement is that the toolbar icon should change rather than appear and disappear.
What you need to read about is message passing. You are right, content scripts have limited chrome API. However, you can contact background page from content script and tell it to execute anything from chrome API for you. First, you need to create a listener on a background page that will be waiting for messages and then send a message from a content script.

click of a submit button on any website using Google extension

On the click of a submit button on any website eg. Amazon, I want a .html to be triggered using google extension. please let me know if it is possible.
You can indeed execute scripts on (almost) any page using content scripts that can manipulate the DOM, allowing you to add an onsubmit event listener to a form (more reliable than onclick on a button as it is fired however the form is submitted - e.g. hitting ENTER).
What exactly do you mean you "want a .html to be triggered"? Triggered in what way? If you want to open another tab when this happens, you can do this using message passing to tell your background page to do this for you using the chrome.tab.create API method.

Resources