Chrome extension maximum message length

1.4k views Asked by At

I'm using the google chrome notification api. My question is really simple and short, is it possible to change the maximum length of the message in the notification?

Example if my question wasn't clear:

That's my notification options:

var options = {
  type: "basic",
  title: title,
  message: text,
  iconUrl: "152.png"
}

In this case text = "Time to the t oast toastt oastt oasttoas ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast ttoasttoast toastt oasttoa sttoastto astto ast oasttoasttoasttoa sttoasttoast toastt oastto asttoastto asttoast toastt oast."

It's just an example

As you can see the notifications api cut it at the middle and added three dots:

enter image description here

So my question is, can I make the notification show the full message and not cut it at the middle?

I've read few tutorials and I saw there is something called expandedMessage , but it doesn't appear in the API documentations and I didn't success using it.

1

There are 1 answers

0
wOxxOm On BEST ANSWER

You're already using the expanded notification and the number of lines is hardcoded to 5 plus the first title line in the source code of Chromium/Chrome. Other types of text notifications may occupy even lesser amount of lines as you can see in the linked code. That's why you see only 5+1=6 lines.

The only way to overcome the limit is to create an image using Canvas API, paint the text and pass the image to chrome.notifications.create.