I have a .js
file which i include like:
<script src="<?php echo $Settings_PathName; ?>/includes/jquery/jquery.js" type="text/javascript"></script>
inside this file is just normal Javascript codes and functions however it stops my <title>
tag from displaying the page title in the browser window.
As soon as i remove this link, the browser title works fine.
i have also tried removing the code from this .js
file and uploading it to the website, but it still causes the same issue
Your html seems good, it's probably an PHP error. If the echo doesn't work, your element can be broken...
first, check your html, it should look like:
<html>
<head>
<title>My Page</title>
<script type="text/javascript" src="<?php echo $Settings_PathName; ?>/includes/jquery/jquery.js"></script>
</head>
<body>
<h1>hello world</h1>
</body>
</html>
In your browser, open the dev tools (press f12 key). In the network panel, you should find your js file in HTTP Status = 200 or 304. If the status = 404 or 500, the script url is wrong.
Else, open the page source (ctl+u) and check the HTML source code write by the php server.
Otherwise, check your php server:
remove the element and replace <h1>hello world</h1>
by <h1><?php echo "hello world"; ?></h1>
If it doesn't work, open your server error log and try to find the issue.
Another simple solution, replace your path by a CDN path :
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
With a CDN you can increase your page loading speed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With