book
Article ID: KB0071038
calendar_today
Updated On:
Description
From TIBCO Spotfire version 7.13, anchor links/html bookmarks (#localref) used in Text Areas no longer work (resulting in 404 errors). This is affecting HTML and JavaScript in the text area, including JQuery.
In Spotfire 7.12 and lower (and also later versions of Analyst) the following html works, but in Web Player 7.13 and higher it does not:
<h2 id="top">Header</h2>
...lots and lots and lots of text...
<a href="#top">Jump</a>
Since the base URL is different in 7.13 and higher, the last link will jump to <base url>#top and that is a non existing page, resulting in a 404 error from the Server.
Resolution
The document URL might differ, and also depends on where the file is saved, so the known workaround is to dynamically run a JavaScript to update the href links to include the document URL. This requires that it's possible to run JavaScript on the Web Player (i.e. not applicable to TIBCO Cloud Spotfire).
jQuery sometimes use those local anchor links (ie tabs/#tabs), and will fail if not using the workaround explained above.
The following JavaScript is a possible workaround. It is updating the href links.
// This script looks for "#" in the href tag and replaces all of them with "<documentURL>#"
$('.sfc-text-area a[href^="#"]').each(function(n, e) {
var current = $(e).attr('href')
$(e).attr('href', document.location.href.split('#')[0] + current)
})There is an existing enhancement request on the TIBCO Ideas portal to provide more consistent use of anchor links in Spotfire which can be found here:
TS-I-8587
Issue/Introduction
Anchor links/HTML Bookmarks (example:
Jump) do not work in Text areas in TIBCO Spotfire web clients of version 7.13 and higher, resulting in 404 errors.
Additional Information
Enhancement: Inconsistent behavior when using <a href=#> in client and Web Player