Does the Javascript Injection work on J4

Search
Other Pre-Sale questions
Forum

Does the Javascript Injection work on J4

Shawn's Avatar Shawn
I've been trying out your free tool for injecting js onto one of my article pages, so far doesn't seem to work. Im using newest version of J4 and following this article: docs4.regularlabs.com/sourcerer/the-basi...tyles-and-javascript
I've tried using this code to call the js on the page:
{source}<?php
   $doc->addScript( JURI::root( true ).'https://bestbibleversion.com/mycss/sticky2.js' ); 
?>{/source}

And also tried using this code for inline:
{source}<?php 
   $myscript = "
    alert('This is JavaScript');
   ";
   $doc->addScriptDeclaration( $myscript );
?>{/source}

This is the page im trying to render the js on: bestbibleversion.com/genesis-1/english-parallel

So far nothing has worked. Any advice?

Regards,
Shawn
Peter van Westen's Avatar Peter van Westen ADMIN
Did you place the code in the article or in a module or somewhere else?
Please post a rating at the Joomla! Extensions Directory
Shawn's Avatar Shawn
This is the css and javascript im trying to use:

{source}<?php
$doc->addStyleSheet( JURI::root( true ).' bestbibleversion.com/mycss/sticky2.css ' );
?>{/source}

{source}<?php
$doc->addScript( JURI::root( true ).' bestbibleversion.com/myjs/js1.js ' );
?>{/source}

I'm placing that code at the top of my article page and an html table below it. Hoping to call that JS and CSS onto the table.
Peter van Westen's Avatar Peter van Westen ADMIN
Not sure why it isn't working.

But this isn't a pre-sales question. I do not offer support on the free version. If you need further help, please consider purchasing a subscription.
Please post a rating at the Joomla! Extensions Directory
You can only post on this forum if you log in