I am facing an issue with linking HTML pages that run Javascript and JQuery Mobile from another HTML page. My link setup is as follows:
<a href="hours.html">Hours</a>
The linking page and the linked pages are in the same directory. However, when I access the page through this link, the JQuery Mobile theme loads but additional CSS changes or any Javascript code fail to execute. None of the methods set to run on startup work, not even a simple alert.
Strangely, when I directly access the page, everything works perfectly fine and my code executes as expected. But when using the HTML link, nothing seems to work. Am I missing something here?
Edit: None of the code seems to be working for any linked page. Not even a basic:
$(document).ready(function(){
alert("Hello world");
});
This code snippet doesn't trigger at all. The placement in the other HTML page looks like this:
<head>
<meta charset="utf-8">
<title>Hours</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link href="http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.css" rel="stylesheet">
<script type='text/javascript' src='https://cdn.firebase.com/v0/firebase.js'></script>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.js"></script>
<script>
$(document).ready(function(){
alert("Hello world");
});
</script>
<style type="text/css">
* {
font-family: "Celeste Mobi Pro", Celeste, serif;
}
</style>
</head>
Neither the CSS font change nor the startup alert popup works. The problem persists across different HTML pages, leading me to believe it might be related to the server I'm hosting these files on.
Second Edit: After testing it locally, the functionality works perfectly. It strongly suggests that the server configuration is causing the issues. Are there specific settings I should look into?
Third Edit: Using the Chrome console, I noticed that scripts added through script tags in the head section are not loading properly on the linked pages. Instead, the contents of the script tags reflect those from the linking page (ensuring I'm inspecting the correct page). Interestingly, upon a page refresh, the scripts seem to update and start functioning as intended.