Include javascript .js file only in selected articles

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
Aneurysm
Joomla! Apprentice
Joomla! Apprentice
Posts: 32
Joined: Wed Apr 28, 2010 3:30 pm
Location: Italy

Include javascript .js file only in selected articles

Post by Aneurysm » Sat Jan 06, 2018 4:37 pm

Hi, I was looking for a way to include a .js file only on few articles, I found an extension called JosTag that seems to work good, it includes the .js before the closing head tag and the javascript runs fine, my question is: is there a better way or extension to to this?

User avatar
Jeyjoo
Joomla! Explorer
Joomla! Explorer
Posts: 344
Joined: Tue Jul 19, 2011 8:56 am
Location: Monaco
Contact:

Re: Include javascript .js file only in selected articles

Post by Jeyjoo » Wed Feb 07, 2018 10:41 pm

Hi I would put the js inline in the article if very few, or use PHP that detects the page id only adding the .js on the specified page ids.
Ultimate guide to setting up a Joomla MULTILANGUAGE website
https://jeyjoo.com/blog/how-to-create-a ... -joomla-3/
Guida siti MULTILINGUE in Joomla
https://jeyjoo.it/blog/creare-un-sito-m ... -joomla-3/


Locked

Return to “Extensions for Joomla! 3.x”