is the javascript code works after html and body tags are closed?

Viewed 29

In php and html, belows code are working?

<?php
//load and define somethings
define("sometings..", "");
define("sometings..", "");

require "some.php";
require "some.php";

$c = new my_someting();

...
...some code
...

//load page templates and exit php
@readfile("someting.page.templates.html");

...
...some code should run after read html;
...

if($debug && is_admin_ip()){
   echo '<script>';
   echo 'console.log("runtime:'.(microtime(true) - $_SERVER['REQUEST_TIME']).' ms")';
   echo 'console.log("'.json_encode(some_used_page_query_class).'")';
   echo 'console.log("'.json_encode(some_others_class).'")';
   echo '</script>';
}
exit;

all page templates(@readfile) closing body and html tags like below.

<!DOCTYPE html>
<html >
<head>
...
</head>
<body>
...
</body>
</html>

I want to know that is it working and is it okay to use like that.

and if its` works or not, is there any way to make my purpose more better or I'm doing good?

0 Answers
Related