Support Forum

Please note that this forum is only available to you in read only mode. In order to contribute to this conversation you will need to renew your subscription.

Error when JS compression is on

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Hi,

I've just discovered the problem with JS compression function. When I turn it on in settings of template the slideshow doesn't work and I get following error:
Refused to execute script from 'lekkie-podroze.pl/templates/venture/js/template-9.php' because its MIME type ('text/css') is not executable, and strict MIME type checking is enabled.

You can see the effect here: lekkie-podroze.pl

If I understand correctly, the problem is with js in *.php file which is created by template's compressor.

When compressor is off and all scripts are loaded separately in .js files - everything works fine.
  • Lukasz's Avatar
  • Lukasz
  • 3 Month Basic
  • 17 posts
  • Karma: 0
Last Edit: 8 years 10 months ago by Lukasz.
The administrator has disabled public write access.
The php files should render fine - its a way of gzipping the contents of the file. But if you go tot he admin in the settings panel and then click compress scripts again does that solve the issue?

Seems like an odd error since the js compressed file has the wrong mime type. Is this the latest version of the theme?

Thanks
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
Thanks for quick reply.
I have the latest version of Venture (1.3.1). Joomla and all extensions are also up to date.

When I disable is theme settings "GZIP Javascript output" and press "Compress scripts" the page works fine. In such a case the file /templates/venture/js/template-9.js is loaded instead of template-9.php

When Gzip js output is enabled compressing again and again doesn't change anything.

I guess there is a problem with interpratetion of php file as js MIME type. Any idea how to fix it?
  • Lukasz's Avatar
  • Lukasz
  • 3 Month Basic
  • 17 posts
  • Karma: 0
The administrator has disabled public write access.
Ah actually - I think this is because of your server setting. The clue is in strict mime type is enabled. I guess there is a protocol on the server thats preventing us from using php to render js files.

Thanks
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
On the same server I have another webpage on Joomla, which uses jchoptimize to merge and gzip js files: www.rosjapl.info/
As you can see the output file is also php: www.rosjapl.info/media/plg_jchoptimize/assets2/jscss.php?f=96a5e2aebee6489676622b692a8f9a19&type=js&gz=gz&d=30&i=0

The only difference is that the script declaration is type="application/javascript" instead of "text/javascript" in our case.
  • Lukasz's Avatar
  • Lukasz
  • 3 Month Basic
  • 17 posts
  • Karma: 0
The administrator has disabled public write access.
Can you try the attached?

There was actually a typo in there anyway calling it css in the js compressor so that didnt help. Ive just changed it to application/js.

Thanks
Attachments:
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
Tried the new file, compiled less and compressed script and I don't see any difference. There is still text/javascript....

PS. The funny thing is that in Firefox it started to work fine. But In Chrome and IE there is the same error
  • Lukasz's Avatar
  • Lukasz
  • 3 Month Basic
  • 17 posts
  • Karma: 0
Last Edit: 8 years 10 months ago by Lukasz.
The administrator has disabled public write access.
I get the correct mime type but the same error:

Refused to execute script from 'lekkie-podroze.pl/templates/venture/js/template-9.php' because its MIME type ('application/js') is not executable, and strict MIME type checking is enabled.

Is there something unique about this site eg htaccess or installed different components.
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
I still cannot get application/js.
I checked with original joomla htaccess - nothing has changed.
I don't have many extensions installed - sitemap, rss, kunena, akeba backup. Nothing what I would suspect to interfere with scripts.

I don't understand why the site works fine on Firefox...
  • Lukasz's Avatar
  • Lukasz
  • 3 Month Basic
  • 17 posts
  • Karma: 0
The administrator has disabled public write access.
Yes its odd. Where are you seeing the old declaration? I can see it in the inspector. Via that error.
Refused to execute script from 'lekkie-podroze.pl/templates/venture/js/template-9.php' because its MIME type ('application/js') is not executable, and strict MIME type checking is enabled.

Thanks
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
I can see it when looking at source of the webpage, in Chrome: view-source:http://lekkie-podroze.pl/

There is still:
script src="/templates/venture/js/template-9.js" type="text/javascript"

or template-9.php if I switch to problematic gzip compression.

On the other webpage on the same server with the same config there is:
script type="application/javascript" src="file.php"
  • Lukasz's Avatar
  • Lukasz
  • 3 Month Basic
  • 17 posts
  • Karma: 0
Last Edit: 8 years 10 months ago by Lukasz.
The administrator has disabled public write access.
Sorry I realised I didn't reply to this thread

Are you still having an issue?

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Hi Paul,
Unfortunately the problem still exists. I am forced do disable gzip js output.
  • Lukasz's Avatar
  • Lukasz
  • 3 Month Basic
  • 17 posts
  • Karma: 0
The administrator has disabled public write access.
Is it possible for you to create a ticket and add ftp access so I can look at this for you?
Thanks
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.
Sure. Just submitted ticket. Thanks
  • Lukasz's Avatar
  • Lukasz
  • 3 Month Basic
  • 17 posts
  • Karma: 0
The administrator has disabled public write access.
Thanks

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Happy Campers