RAW Content - "ghost" script

Hi

Into my page:

I have a RAW Content element with the following code:

<div id="app"></div>
<script type="application/javascript">
    window.partnerCode = "90";
    window.blockBrandPages = true;
    window.defaultLang = "it";
</script>
<script src="https://eurococ.eu/spa/products/js/app-ie-handler.js?ver=1.1"></script>
<script src="https://eurococ.eu/spa/products/js/app.js?ver=1.1"></script>

When I preview the page on Browser:
If I am logged into Wordpress the page source code visualize also:

<script type="application/javascript">
    window.partnerCode = "90";
    window.blockBrandPages = true;
    window.defaultLang = "it";
</script>

If I am NOT logged into Wordpress the page source code DOESN’T visualize that part of code.

Could you help me with this strange behavior?

Isn’t it possible to put the little script in the local JS area?
But maybe you have a reason to put it into raw content?

Hello Daniele,

Thanks for writing in! I have inspected your page and I can see that your custom JS code is working because it displays the tab. I could not replicate the issue as well.

In which browser you used you have encountered the issue?

Best Regards.

Thank You Ruenel

As you can see, the language in you sreenshot is “English” and not “Italian” as set in the code:

window.defaultLang = "it";

I use Google Chrome

f I am logged into Wordpress the page source code visualize also (and the script works fine in ITALIAN language):

<script type="application/javascript">
    window.partnerCode = "90";
    window.blockBrandPages = true;
    window.defaultLang = "it";
</script>

If I am NOT logged into Wordpress the page source code DOESN’T visualize that part of code (and the script works with ENGLISH language).

Hey Daniele.

Do you have an example link for your ghost script? what we want is to know how it should look like.

Thank you.

Here it is
(Did I understand the request correctly?)

Hi Daniele,

I checked the URL but didn’t find any ghost scripts in it. Also checked the output using the view-source, and as it is minified didn’t locate it either. I would request you please provide login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password

To create a secure note, click the key icon underneath any of your posts.

NOTE: Please remember that the Raw Content element is for adding the HTML content inside the content, whereas you can add scripts in it. But it is suggested to add the scripts into the Page Js.

Thanks

I’ve added (now) the scripts into the Page Js
but the problem is not fixed

Here it is secure note

Hi Daniele,

It seems that the code is working perfectly and showing the value in English. I would suggest you contact the author or service from where you get this code, they might have some clue on it. Please remember that we don’t provide any support for the custom coding issues.

Thanks

Hi @tristup

the problem is just that: the variable

window.defaultLang = "it";

should set the language to ITALIAN,
but it seems that the code

<script type="application/javascript">
    window.partnerCode = "90";
    window.blockBrandPages = true;
    window.defaultLang = "it";
</script>

is not inserted in the source page

Hey Daniele,

I didn’t log in to your site, but your scripts show Italian.

But anyway, our concern here as support is if the JS code is in your site’s source code and it is. This means our theme does not interfere with the function of your custom code.

image

If the issue persists on your end, please clear your browser’s cache and all caching systems enabled on your site including server cache. Also, contact the custom code provider because this is not an issue with our theme.

Thank You for your precious support.

I will investigate in order to understand if the problem is due to another SG Optimizer option.

Hi Daniele,

Glad that we are able to help you.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.