I'm quite new to actually truing to use crossrider and my javascript knowledge is very basic so the following is probably very obvious to most developers but not to me.
I would simply like to know the correct method for creating a hyperlink from the text inside a popup such as 'Go to example'.
Incredibly enough placing it just like that worked for Safari but predictably it didn't work on Chrome...
I imagine that the proper way is through 'appAPI.openURL' but I haven't found how to call that function by itself.
Your help is much appreciated.
Help get this topic noticed by sharing it on
Twitter,
Facebook, or email.
Twitter,
Facebook, or email.
-
Hello edson.ajj,
Are you injecting the 'Go to example' text? If so, just inject it with the HTML anchor tag as you have in the text you provided.
If you can provide some background information of what you are trying to achieve, I will be better able to give you guidance :-)
For information about using openURL, see appAPI.openURL and the demo extension. -
-
Since te previous answers have not been effective I'll try to explain differently this time around.
Currently I have a form apear on a popup from either a browser action (Safari and IE) or a page action (Chrome and Firefox). Part of the text instructs the user to check data with an hyperlink to this site: SCT".
When I put just the standard "a href" code into the extension and test it on Chrome it doesn't work as intended, instead it opens a new tab with a blank page that shows the full extension ID in the URL.
The text I'm trying to make a hyperlink is the one in the red square of this image.
Could you please tell me the proper way to add the hyperlink according to crossrider's API?
I already tried to use "appAPI.openURL" but I haven't been able to figure out how to call it from something that isn't a button like used on the example. -
-
Hello edson.ajj,
Thanks for clarifying the scenario.
For links to work when using browser/page action popups (appAPI.browserAction.setPopup/appAPI.pageAction.setPopup), inject the links. For example, create a wrapper for the link in the body of the popup and then in the crossriderMain function inject the link:<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-COMPATIBLE" content="IE=edge">
<script type="text/javascript">
function crossriderMain($) {
$('<a />').text('example').click(function(event) {
event.preventDefault();
appAPI.openURL({
url:'http://example.com/',
where: 'tab'
});
}).appendTo('#link-wrapper');
}
</script>
</head>
<body>
Go to <span id="link-wrapper"></span>.
</body>
</html> -
Loading Profile...




EMPLOYEE

I have read the documentation and seen the demo extension but I do not understand how to call the function from text.