Main.js
:
require([
'jquery',
'backbone',
....
'src/views/components/CookieBannerComponent'
...
],
function ($, _, Backbone, App, ApplicationRouter, TopMenuComponentMobile, CookieBannerComponent,
BrowserCompatibilityComponentMobile) {
$(document).ready(function () {
...
var coockieBanner = new CookieBannerComponent;
}
...
}
CookieBannerComponent.js
:
function ($, _, Backbone, BaseComponentMobile) {
return BaseComponentMobile.extend({
initialize: function () {
BaseComponentMobile.prototype.initialize.apply(this,
arguments);
try {
function OptanonWrapper() { ... }
当用户将更改保存到Cookie同意设置时,将调用函数OptanonWrapper
。然后OptanonWrapper
函数停用JavaScript中的cookie设置。问题是,目前OptanonWrapper
不可见。通常,它必须位于网站的<head>
标签中。我如何使该函数global
可以被调用?