I'm working on fiori app and I want to enable clickjacking protection, I know this is can be done by add
data-sap-ui-frameOptions
to every script in html index page, but I want to use this is component.js file cause it's the principal page that will be used in production deployment.
<script src='https://ui5.sap.com/1.102.1/resources/sap-ui-core.js'
data-sap-ui-libs='sap.m, sap.ushell, sap.fe.templates'
data-sap-ui-compatVersion='edge'
data-sap-ui-theme='sap_fiori_3'
data-sap-ui-frameOptions='deny'
data-sap-ui-bindingSyntax='complex'></script>
<script>
this is what I did in component.js file :
sap.ui.define(['sap/fe/core/AppComponent'], function(AppComponent) {
'use strict';
return AppComponent.extend('evsapfiori.organization.Component', {
metadata: {
manifest: 'json'
},
init: function() {
// eslint-disable-next-line no-undef
const scripts = document.scripts;
scripts.forEach((script) => {
script.setAttribute('data-sap-ui-frameOptions','deny');
});
}
});
});
I want to verify if it's correct and I'm in the right way !