0

Our webserver has set X-Frame-Options to 'sameorigin'. So if I want to open the attribution links in an OpenStreetMap, the requests get blocked. So I want to let the links be opened in a new tab. How do I change the target-property of the a-elements to '_blank' while still using the OpenLayers API? I want do change it with the OpenLayers API and not "from outside" with JQuery etc. enter image description here

notices of errors etc

1

You can set attribution of source as [], then only openlayers.org link will be left.

source: new ol.source.OSM({
  attributions: [],
  ...

or you can remove the whole attribution by setting attributionOptions option with className: ""

controls: ol.control.defaults({
  attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
    collapsible: false,
    className: ""
  })
}), 

to set target="_blank", customize attribution like:

attributions: [
  'All maps © <a href="http://www.openseamap.org/" target="_blank">OpenSeaMap</a>',
  ol.source.OSM.ATTRIBUTION
],
0

The solution will be to disable the X frame error, I had the same issue and the link below helped me solve this;

https://helpx.adobe.com/target/kb/how-to-use-a-browser-extension-to-remove-x-frame-options-console.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.