I have a website with a parent page (index.php) that loads all the child pages in a frame and keeps the URL static (so if I navigate throughout the site the URL will always be htps://localhost/myWebsite/).
Now when I directly go to a child page (htps://localhost/myWebsite/childPage.php) the page will load without style and the website will not be on index.php.
so I have coded a solution to this by redirecting all child Pages back to index.php page and loading the frame content based on a session variable I passed through via HTML5. once on the index.php page the session variable will be cleared and all is good.
The only problem with this is that I am hard-coding a URL for a condition check inside of a external .JS file which holds my procedures for redirecting, setting/clearing session variable. My boss says he doesn't want any hard-coding whatsoever so I am wondering if there is a way to grab the index.php page URL value, regardless of the page that you are currently on?
I need to have a variable which will always hold the value "htps://localhost/myWebsite/" (Main URL) and a variable that will always hold the value: "htps://localhost/myWebsite/index.php" (Home Page)
var theURL = window.location.protocol
+ "//"
+ window.location.hostname
+ window.location.pathname;
var theURL = document.URL;
both of these work great for grabbing the current URL value but changes on different pages. I have tried using PHP to get the server root but it navigates me to an hierarchical view of the website.
Is there a way to do this? Or should I find a different solution entirely?