Using base tag on a page that contains SVG marker elements fails to render marker

The HTML <base> element is used to say “resolve all relative URLs relative not to this page, but to a new location”. In your case, you’ve told it to resolve relative to the directory with the HTML page. The SVG marker-mid=”url(…)” attribute is a FuncIRI Reference. When you use a value like url(#foo) that relative … Read more

How to get domain URL and application name?

Take a look at the documentation for HttpServletRequest. In order to build the URL in your example you will need to use: getScheme() getServerName() getServerPort() getContextPath() Here is a method that will return your example: public static String getURLWithContextPath(HttpServletRequest request) { return request.getScheme() + “://” + request.getServerName() + “:” + request.getServerPort() + request.getContextPath(); }

Laravel: Get base URL

You can use the URL facade which lets you do calls to the URL generator So you can do: URL::to(“https://stackoverflow.com/”); You can also use the application container: $app->make(‘url’)->to(“https://stackoverflow.com/”); $app[‘url’]->to(“https://stackoverflow.com/”); App::make(‘url’)->to(“https://stackoverflow.com/”); Or inject the UrlGenerator: <?php namespace Vendor\Your\Class\Namespace; use Illuminate\Routing\UrlGenerator; class Classname { protected $url; public function __construct(UrlGenerator $url) { $this->url = $url; } public function … Read more