-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there any known conflicts with Joomla ? #980
Comments
Make sure the lines you add are processed as HTML and not PHP.
…On Wed, Feb 19, 2025, at 08:48, Nathan MICONI wrote:
I work on a website made with Joomla.
I'm trying to import html5-qrcode like this `<script ***@***.***/html5-qrcode.min.js"></script>`
But I get this error `html5-qrcode.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'length')`
I tested on a new project (no Joomla, just an html and js file), and it works. So it may be because of Joomla but I can't find why.
Can anyone help me ?
—
Reply to this email directly, view it on GitHub <#980>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARTX7KJVO6Y4KZA5GFAPEL2QSDTBAVCNFSM6AAAAABXOHXFYOVHI2DSMVQWIX3LMV43ASLTON2WKOZSHA3DGNBQHE2TMNA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
Black4rrow*Black4rrow* created an issue (mebjas/html5-qrcode#980) <#980>
I work on a website made with Joomla.
I'm trying to import html5-qrcode like this `<script ***@***.***/html5-qrcode.min.js"></script>`
But I get this error `html5-qrcode.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'length')`
I tested on a new project (no Joomla, just an html and js file), and it works. So it may be because of Joomla but I can't find why.
Can anyone help me ?
—
Reply to this email directly, view it on GitHub <#980>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARTX7KJVO6Y4KZA5GFAPEL2QSDTBAVCNFSM6AAAAABXOHXFYOVHI2DSMVQWIX3LMV43ASLTON2WKOZSHA3DGNBQHE2TMNA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
What do you mean ? |
PHP often has a mixture of PHP code and raw HTML. The PHP gets processed on the server, the HTML on the client. It looks like the PHP is trying to process the JavaScript - which I’m not expecting to work.
…On Wed, Feb 19, 2025, at 09:50, Nathan MICONI wrote:
>
> Make sure the lines you add are processed as HTML and not PHP.
> … <#>
>
What do you mean ?
—
Reply to this email directly, view it on GitHub <#980 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARTX7O5TOQA2KWBC3LLVFD2QSK2TAVCNFSM6AAAAABXOHXFYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRYHA3TQMZRGQ>.
You are receiving this because you commented.Message ID: ***@***.***>
Black4rrow*Black4rrow* left a comment (mebjas/html5-qrcode#980) <#980 (comment)>
>
> Make sure the lines you add are processed as HTML and not PHP.
> … <#>
>
What do you mean ?
—
Reply to this email directly, view it on GitHub <#980 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARTX7O5TOQA2KWBC3LLVFD2QSK2TAVCNFSM6AAAAABXOHXFYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRYHA3TQMZRGQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
But here is the start of my page `<?php defined('_JEXEC') or define('_JEXEC', 1); require_once(JPATH_BASE . DS . 'includes' . DS . 'defines.php'); use Anthias\Security; $mainframe = JFactory::getApplication('site'); $db = JFactory::getDbo(); ini_set('display_errors', 1); if (!Security::getInstance()->isLoggedIn()) {
Is something wrong here ? |
Now that you’ve shown code - that looks ok.
Looking more closely at the error makes me wonder if something you’re touching (accessing the length property) doesn’t always have that property.
The test you ran without Joomla - did it have a doctype header? When Joomla generates the HTML, did it have a doctype header?
What I’m thinking is the browser is conditionally exposing a property or class based upon some logic - you’re not working on a level playing field.
On Wed, Feb 19, 2025, at 10:39, Nathan MICONI wrote:
But here is the start of my page
`<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
defined('_JEXEC') or define('_JEXEC', 1);
defined('JPATH_BASE') or define('JPATH_BASE', "../../");
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
require_once(JPATH_BASE . DS . 'includes' . DS . 'defines.php');
require_once(JPATH_BASE . DS . 'includes' . DS . 'framework.php');
use Anthias\Security;
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
$db = JFactory::getDbo();
$user = JFactory::getUser();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if (!Security::getInstance()->isLoggedIn()) {
http_response_code(403);
exit;
}
?>
<title>Scanner</title>
`<link href="./espace_client/public/dist/css/stocklist.min.css" rel="stylesheet">
<link href="./espace_client/style/remixIcon/fonts/remixicon.css?d=14218" rel="stylesheet">
<script ***@***.***/html5-qrcode.min.js"></script>
<script src="./espace_client/scanner/quagga.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.datatables.net/v/bs4/dt-1.11.1/datatables.min.js"></script>
<script ***@***.***"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/featherlight/1.7.13/featherlight.min.js" integrity="sha512-0UbR6HN0dY8fWN9T7fF658896tsPgnbRREHCNq46J9/JSn8GonXDZmqtTc3qS879GM0zV49b9LPhdc/maKP8Kg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="./espace_client/scanner/scanner.js"></script>
<script src="/espace_client/stocklist/stocklistJS.js"></script>
`
`
Is something wrong here ?
—
Reply to this email directly, view it on GitHub <#980 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARTX7MO7C7BNCM6YIBICZL2QSQRZAVCNFSM6AAAAABXOHXFYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRZGAYTQNBXG4>.
You are receiving this because you commented.Message ID: ***@***.***>
Black4rrow*Black4rrow* left a comment (mebjas/html5-qrcode#980) <#980 (comment)>
But here is the start of my page
`<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
defined('_JEXEC') or define('_JEXEC', 1);
defined('JPATH_BASE') or define('JPATH_BASE', "../../");
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
require_once(JPATH_BASE . DS . 'includes' . DS . 'defines.php');
require_once(JPATH_BASE . DS . 'includes' . DS . 'framework.php');
use Anthias\Security;
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
$db = JFactory::getDbo();
$user = JFactory::getUser();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if (!Security::getInstance()->isLoggedIn()) {
http_response_code(403);
exit;
}
?>
<title>Scanner</title>
`<link href="./espace_client/public/dist/css/stocklist.min.css" rel="stylesheet">
<link href="./espace_client/style/remixIcon/fonts/remixicon.css?d=14218" rel="stylesheet">
<script ***@***.***/html5-qrcode.min.js"></script>
<script src="./espace_client/scanner/quagga.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.datatables.net/v/bs4/dt-1.11.1/datatables.min.js"></script>
<script ***@***.***"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/featherlight/1.7.13/featherlight.min.js" integrity="sha512-0UbR6HN0dY8fWN9T7fF658896tsPgnbRREHCNq46J9/JSn8GonXDZmqtTc3qS879GM0zV49b9LPhdc/maKP8Kg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="./espace_client/scanner/scanner.js"></script>
<script src="/espace_client/stocklist/stocklistJS.js"></script>
`
… `
Is something wrong here ?
—
Reply to this email directly, view it on GitHub <#980 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARTX7MO7C7BNCM6YIBICZL2QSQRZAVCNFSM6AAAAABXOHXFYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRZGAYTQNBXG4>.
You are receiving this because you commented.Message ID: ***@***.***>
|
I checked, and I have a 'DOCTYPE' header in both cases (I linked some images). So, this may not be the problem. But I'll show you my Joomla article's configuration below, can this be the problem ?
Also, on Joomla's Administrator, it says i'm using an old version of PHP (PHP 7.4.33), do you think it may be the cause ? Maybe it's a conflict with an Joomla plug-in or extension, I'm searching the problem since yesterday and can't fin it. |
I identified a problem, in my Joomla template (rt_lexicon), there is that instruction So now I have to figure out why. |
Great progress. You might try moving your script line down the PHP file and see if that resolves the issue.
…On Thu, Feb 20, 2025, at 10:47, Nathan MICONI wrote:
I identified a problem, in my Joomla template (rt_lexicon), there is that instruction `$gantry->displayHead(); `
When I remove it (the website if broken of course), but the error in html5-qrcode.min.js disapear and I can use it.
So now I have to figure out why.
—
Reply to this email directly, view it on GitHub <#980 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARTX7PKVGCIZFEIYEBKDYD2QX2KDAVCNFSM6AAAAABXOHXFYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZRHA4TONBQGM>.
You are receiving this because you commented.Message ID: ***@***.***>
Black4rrow*Black4rrow* left a comment (mebjas/html5-qrcode#980) <#980 (comment)>
I identified a problem, in my Joomla template (rt_lexicon), there is that instruction `$gantry->displayHead(); `
When I remove it (the website if broken of course), but the error in html5-qrcode.min.js disapear and I can use it.
So now I have to figure out why.
—
Reply to this email directly, view it on GitHub <#980 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARTX7PKVGCIZFEIYEBKDYD2QX2KDAVCNFSM6AAAAABXOHXFYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZRHA4TONBQGM>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Since the PHP code is effectively writing the HTML that will be sent to the browser that HTML could be invalid. I’m wondering if changing the location of the line you added (the line with the script tag including qrcode) can resolve the original issue?
…On Fri, Feb 21, 2025, at 02:26, Nathan MICONI wrote:
I don't understand, the line is in PHP, so that can't be the problem.
Also, the website works very well, I just can't load html5-qrcode because it creates an error.
Capture.d.ecran.2025-02-21.082518.png (view on web) <https://github.com/user-attachments/assets/5cfc8a5a-c698-449b-80bd-19e178f8b857>
—
Reply to this email directly, view it on GitHub <#980 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARTX7IDIN5K2FWAIHQENFD2Q3IMBAVCNFSM6AAAAABXOHXFYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZTG44DKMRXG4>.
You are receiving this because you commented.Message ID: ***@***.***>
Black4rrow*Black4rrow* left a comment (mebjas/html5-qrcode#980) <#980 (comment)>
I don't understand, the line is in PHP, so that can't be the problem.
Also, the website works very well, I just can't load html5-qrcode because it creates an error.
Capture.d.ecran.2025-02-21.082518.png (view on web) <https://github.com/user-attachments/assets/5cfc8a5a-c698-449b-80bd-19e178f8b857>
—
Reply to this email directly, view it on GitHub <#980 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AARTX7IDIN5K2FWAIHQENFD2Q3IMBAVCNFSM6AAAAABXOHXFYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNZTG44DKMRXG4>.
You are receiving this because you commented.Message ID: ***@***.***>
|
I work on a website made with Joomla.
I'm trying to import html5-qrcode like this
<script src="https://unpkg.com/[email protected]/html5-qrcode.min.js"></script>
But I get this error
html5-qrcode.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
I tested on a new project (no Joomla, just an html and js file), and it works. So it may be because of Joomla but I can't find why.
Can anyone help me ?
The text was updated successfully, but these errors were encountered: