0

I've got a variable that gets the server url of the user:

var server = parent.Xrm.Page.content.getClientUrl;

I want to use that variable to be the first part of a html link and add the page name to the end of it to generate links for different pages. For example for the home page I need the a href to be a combination of var server and /homepage. I tried the following:

<a href="" onclick="this.href = 'server'+'/homepage" target="_blank">

But this didn't work. Any solution would be appreciated!

T.Doe
  • 1,969
  • 8
  • 27
  • 46

1 Answers1

1

You can write an onclick method which will be implemented in javascript. There you will get the variable.

HTML:

<a href="" onclick="getUrl()" >

JS:

getUrl(){
window.open(server +'/homepage,  '_blank');
}

or you can send the extra string from html as parameter

<a href="" onclick="getUrl('/homepage')">

-

getUrl(url){
window.open(server + url,  '_blank')

}
Mahbub Moon
  • 491
  • 2
  • 8