Welcome guest, is this your first visit? Create Account now to join.
Results 1 to 10 of 10

This is a discussion on Notification Bar within the Chrome Plugins section, part of the Google Chrome category: Hi.. I am writing an extension for chrome. Is there a chrome equivalent for Firefox's NotificationBox? Can I show that ...


  1. #1
    irmn is offline Junior Member
    Join Date
    Mar 2011
    Posts
    12

    Default Notification Bar

    Hi.. I am writing an extension for chrome. Is there a chrome equivalent for Firefox's NotificationBox? Can I show that top notification bar through my code which appears when chrome asks the user to save/remember password?

    My extension doesn't have a toolbar icon, so there will be no browserAction. Plus, I don't think pageAction would be of any use..? As it shows some title/popup when the user clicks it.. but i need to show user some information based on what user enters in the omnibar.

    I am not looking for desktop notifications.

    Any pointers would be appreciated. Thanks.

  2. #2
    PAEz's Avatar
    PAEz is offline Moderator
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    656

    Default

    Is there a chrome equivalent for Firefox's NotificationBox?
    I have no idea what that is.

    Can I show that top notification bar through my code which appears when chrome asks the user to save/remember password?
    These are called infobars in chrome and are still in the experimental stage (you cant put things that use the experimental api on the official gallery, but its cool for your own use).....
    http://code.google.com/chrome/extens...erimental.html
    ....or you can fake it and inject something into the page their looking at (pretty sure I saw someone do this on the google group, but I couldnt find it, sorry).

    but i need to show user some information based on what user enters in the omnibar.
    The omnibox api has suggestions, but I guess thats not enough for you?....
    http://code.google.com/chrome/extensions/omnibox.html

    Sorry I couldnt be more help.

  3. #3
    irmn is offline Junior Member
    Join Date
    Mar 2011
    Posts
    12

    Default

    Hi PAEz. Thanks for your reply. Yeah, InfoBar is what I was looking for.. too bad it's just experimental. :-( And I can't go with omnibox suggestions as they appear only when user is inputting something into the omni bar and still haven't accepted the input.

    Here's what my addon is doing. It's using OmniBox keyword.. user enters the keyword and then some command.. and then hit enter. Now, based on user input, I have to show him some notifications. Also, I though of falling back to desktop notifications right now, but too sad, I can show them, but can't hide them..! There's no 'close' method..! So, I can't display a time-based desktop notification..!

  4. #4
    PAEz's Avatar
    PAEz is offline Moderator
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    656

    Default

    How about a good old fashioned popup window?
    http://code.google.com/chrome/extensions/windows.html
    ...maybe not so pretty, but youll get all the control you need.

  5. #5
    irmn is offline Junior Member
    Join Date
    Mar 2011
    Posts
    12

    Default

    Its better than the alert boxes I am currently using as the user can choose to ignore them. But, another browser window? :-( Users are not going to forgive me for that either.. lol.. But, i think i should go with these for now. Thanks PAEz.

    Any ideas when the infobar api is going mainstream? Also.. isn't there a way to add some content to the current page the user is viewing? I could add a javascript style time based popup in there..? I am aware of content scripts, but then they work for only the websites that I add in manifest, and of course, user could be viewing any webpage while using my extension..

  6. #6
    PAEz's Avatar
    PAEz is offline Moderator
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    656

    Default

    I have no idea when the infobars will come out of experimental, sorry.

    You could add something to the page the user is viewing but my html skills are seriously lacking so I wont be much help. You can track what tab/window a user is viewing by using the tabs api.....
    http://code.google.com/chrome/extensions/tabs.html
    ...getSelected to know what tab their viewing now and watch onSelectionChanged to know when its changed.
    You could possibly then insert your stuff using a script and executeScript to put it in the page and insertCSS from the background page.
    Then I think (remember I dont know jack html) you would add a div or maybe an iframe and use the CSS to position it absoloute and make sure its zindex makes it on top and overflow is hidden.....something like that ..... Im sure Ive seen this somewhere but for the life of me couldnt find it.

    Good luck

  7. #7
    irmn is offline Junior Member
    Join Date
    Mar 2011
    Posts
    12

    Default

    PAEz, you are right about the tabs thing. It's working cool for me now. Thanks. One more glitch now though.. lets say the user have a page open when he uses my extension through omnibar.. i am adding some script and css dynamically and displaying a JS popup on the top of the page. Same goes on for https pages. I have done this by adding permissions http://*/* and https://*/* in manifest. Now, let's say, the user opens a new tab and uses my extension.. how would i add the content here.. as it's neither a http or https page, also, it tried with chrome://*/* permissions but chrome doesn't like it.

  8. #8
    PAEz's Avatar
    PAEz is offline Moderator
    Join Date
    Aug 2009
    Location
    Australia
    Posts
    656

    Default

    ahhhhh, I forgot to mention that....Extensions cant accesse the NTP or the extension gallery pages, or other internal Chrome pages.
    I guess the only thing you could do there would be to redirect the page to one thats part of your extension and notify the user and when they dismiss the notice, go back.....far from ideal.

  9. #9
    irmn is offline Junior Member
    Join Date
    Mar 2011
    Posts
    12

    Default

    Yeah.. but still its way too better than alerts and popups right.. This is the best solution so far. And, I will switch to InfoBars when they are out.

  10. #10
    irmn is offline Junior Member
    Join Date
    Mar 2011
    Posts
    12

    Default

    How do I mark this thread as [Solved] ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •