I am looking to create a custom alert box that triggers on page load instead of the default one, which I find unattractive and possibly irritating for users.
alert('hello');
My current approach involves the following code:
manifesto.js
"content_scripts": [
{
"matches": ["http://www.google.com"],
"js": ["alert.js"]
}
]
alert.js
window.onload = function()
{
if(document.body.innerHTML.toString().indexOf('google') > -1 {
alert('Hello Google');
}
}
This setup will display an alert box when the user is on google.com. However, I am seeking a more visually appealing solution. I have experimented with notifications, but unfortunately it does not seem possible to implement them via content_scripts. Therefore, my current strategy is to design a friendly custom alert box.