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!
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')
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.