Ticket #556 (closed defect: fixed)
stripBaseHref (for relative link)
| Reported by: | tzenghuei.ang@… | Owned by: | gogo |
|---|---|---|---|
| Priority: | low | Milestone: | Version 1.0 |
| Component: | Xinha Core | Version: | |
| Severity: | minor | Keywords: | relative link |
| Cc: |
Description
this doesn't seems work, however, i come up a simple replacement :
if(typeof this.config.stripBaseHref != 'undefined' && this.config.stripBaseHref)
{
var baseRe = null
if(typeof this.config.baseHref != 'undefined' && this.config.baseHref != null)
{
baseRe = new RegExp(this.config.baseHref.replace(HTMLArea.RE_Specials, '\\$1'), 'g');
html = html.replace(baseRe, '');
}
else
{
//baseRe = new RegExp(document.location.href.replace(/([^\/]*\/?)$/, '').replace(HTMLArea.RE_Specials, '\\$1'), 'g');
// fixing base href problem
var host_name = document.location.host;
var host_protocol = document.location.protocol;
var _reg = eval('/href="'+host_protocol+'\\/\\/'+host_name+'/');
baseRe = new RegExp(_reg);
html = html.replace(baseRe, 'href="');
}
}
Change History
Note: See
TracTickets for help on using
tickets.
