2

I came to know that crossrider.com is helping us to develop extension for different browsers, while keeping the same code.

I have two questions

Question 1:

After going through docs and libraries in crossrider, I still wonder how to get the active tab url.

Question 2:

I also need to open a popup after clicking toolbar icon, similar to google chrome extension. I came across crossrider siderbar plugin. But, I am unable to change the url for sidebar dynamically. Do we have any other crossrider plugins which opens like an popup ?

Aravind S
  • 91
  • 7

2 Answers2

3

Answer Q1: You can use our appAPI.tabs.onTabSelectionChanged(function callback([{tabId, tabUrl}])) method (soon to be documented). To keep track of the ActiveTab URL, in the callback, simply set a global variable to the callback's optional tabUrl parameter. This is currently supported in Chrome and Firefox.

Answer Q2: I'm afraid that currently there isn't a native popup plugin (your welcome to write one and submit it for consideration ;-)). However, you can configure and use jQueryUI popups from within the extension.

Shlomo
  • 3,763
  • 11
  • 16
  • Thanks for your reply. Reply to Q1: I need this support for IE. :) Reply to Q2: I saw sidebar plugin, and added in my extension. But, I am still getting JS object not found error. Do we have any example extension that uses this plugin?. I am ready to write a new plugin using jquery popup, if you point me some documentation on how to write plugins. – Aravind S Dec 03 '12 at 16:28
  • In answer to Q2, when you view the Sidebar plugin in our IDE (http://crossrider.com/developer/plugins) or add the plugin to your extension, there is a snippet that shows you how to use the plugin. Note: The sidebar must be loaded from within the appAPI.ready method on your extension.js file. – Shlomo Dec 04 '12 at 09:04
1

I need to get active tab url in IE. If it is not possible using jquery in IE, can we use messaging api to send messages from pages to background scope, and store the active tab url in background's global variable?

Aravind S
  • 91
  • 7
  • Hello Aravind: Yes, you can add a listener using to the background scope (background.js) using appAPI.message.addListener (http://docs.crossrider.com/#!/api/appAPI.message-method-addListener) and then send a message to the background scope using appAPI.message.toBackground (http://docs.crossrider.com/#!/api/appAPI.message-method-toBackground) from the extension scope (extension.js). Note: You can use window.focus(callback) in extension.js to detect when a tab becomes active. – Shlomo Dec 04 '12 at 09:00