Last modified 6 years ago
Using absolute URLs
To avoid problems generated by relative URLs (i.e. images not displayed in the editor), simply use full absolute URLs.
For example, if your CMS is hosted at http://cms.company.tld and you're editing http://www.customer.tld, add this base location to SRCs and HREFs.
This is an example of implementation in C#:
Initialization
//initializing the editor
string base_href="http://www.customer.tld";
strHtml="..."; //initialize strHtml by the value in the DB, XML, ...
strHtml=strHtml.Replace("src=\"/","src=\""+p_base_href+"/");
strHtml=strHtml.Replace("href=\"/","href=\""+p_base_href+"/");
editor.InnerHtml=strHtml;
Update
//updating the DB, XML, with the value coming from the editor
strHtml=strHtml.Replace("src=\""+p_base_href,"src=\"");
strHtml=strHtml.Replace("href=\""+p_base_href,"href=\"");
//update the DB, XML, ...