I'm creating an extension using Crossrider that allows users to bookmark the page they are viewing.
For this purpose, I created a button popup that when clicked opens with the UI for managing the list of bookmarks. When the user clicks on the extension's button I want to pass the URL of the page being viewed to the popup so that I can add it to the list of bookmarks. My problem is that I don't know how to pass the URL to the popup. Can anyone point me in the right direction?
The following snippet is a simplified version of the code to demonstrate what I have:
background.js:
appAPI.ready(function($) {
appAPI.browserAction.setResourceIcon('images/icon.png');
appAPI.browserAction.setPopup({
resourcePath:'html/popup.html',
height: 300,
width: 300
});
});
popup.html:
<!DOCTYPE html>
<html>
<head>
<!-- This meta tag is relevant only for IE -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="text/javascript">
function crossriderMain($) {
}
</script>
</head>
<body>
<h1>Bookmark List</h1>
<ul>
<li>1: http://example.com/1.html</html>
<li>2: http://example.com/2.html</html>
</ul>
</body>
</html>