Issues with the <base> tag

Troubleshooting

Summary

Using a <base> tag with yFiles can cause problems.
For a better user experience, please go to the integrated documentation viewer to read this article.

Description

Some web pages use a <base> tag to specify the base URL for the entire page. This approach is not compatible with inline SVG, which yFiles for HTML relies on heavily to display the visual graph. The <base> tag disrupts all references within the SVG. For instance, the following example will not work:

<svg xmlns="http://www.w3.org/2000/svg">
  <defs>
    <linearGradient id="myFill">...</linearGradient>
  </defs>
  <rect fill="url(#myFill)"></rect>
</svg>

As a result, this can lead to missing fills (resulting in black or transparent shapes, dependent on the browser), or disappearing elements.

This is not a problem in Chrome, which ignores the base tag when resolving references.

Don't Use a <base> Tag

Determine why the <base> tag is necessary and explore whether it can be removed.

If you are using AngularJS, consider enabling html5Mode instead, as described here:.

const app = angular.module('app', [<user definitions>]);
app.config($locationProvider => {$locationProvider.html5Mode({enabled: true, requireBase: false});});

Categories this article belongs to:
yFiles for HTML > Other
Applies to:
yFiles for HTML: 1.3, 1.4, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 3.0
Keywords:
base - angular - angularjs - disappear - html5mode - black - invisible