Hello Daniweb Community
I am creating a website and wish for the pages url to be the same.
For example.
The site is
I wish for the page
to appear as company.com
If you could help I would be very grateful
thank you
Grantmitch1
Hello Daniweb Community
I am creating a website and wish for the pages url to be the same.
For example.
The site is
I wish for the page
to appear as company.com
If you could help I would be very grateful
thank you
Grantmitch1
wanted every page to show the same address (for example, always show company.com even when the site loads /help.htm). Replies from and mentioned frames and security concerns. Frames do let you keep the top-level URL unchanged, but they are outdated and fragile. A more modern and controllable approach is to load page content into a single “shell” page via JavaScript (AJAX/Fetch) so the address bar never changes unless you explicitly call the history API.
A simple, practical pattern: serve one index page that contains a content container, intercept internal link clicks, fetch the target HTML on click, extract the fragment you need, and replace the container’s innerHTML. This keeps the address the same because you do not call history.pushState. Example (naive) client-side handler:
document.addEventListener('click', function(e) {
var a = e.target.closest('a');
if (!a || a.target === '_blank' || a.host !== location.host) return;
e.preventDefault();
fetch(a.pathname)
.then(r => r.text())
.then(html => {
var tmp = document.createElement('div');
tmp.innerHTML = html;
var fragment = tmp.querySelector('#content') || tmp;
document.querySelector('#content').innerHTML = fragment.innerHTML;
})
.catch(console.error);
}); Caveats and notes: fetched pages must provide the fragment you want (or you must extract it). Scripts in fetched HTML won’t auto-run; relative URLs and forms may need fixing. This breaks bookmarking and the back/forward behavior unless you deliberately use the History API (History.pushState). If you must embed full external pages, frames/iframes may work but can be blocked by site headers (see X-Frame-Options) and harm SEO. For server routing and SPA fallbacks, consult your server docs (example: Apache mod_rewrite). For AJAX basics see the Fetch API.
Jump to Post— ShawnCplus 456You can't really do that unless you use a frame and links on the page would open in the frame instead of their own separate page. Also, try not to
use
threereturns
afterevery
few
wordsIt's annoying.
Jump to Post— ShawnCplus 456OK then you just answered your own question, go look up how to use frames. w3schools.com is a good resource.
Jump to Post— MidiMagic 579It should be made impossible to do this. The fact that it can be done is a way crackers can sneak into computers.
You can't really do that unless you use a frame and links on the page would open in the frame instead of their own separate page. Also, try not to
use
three
returns
after
every
few
words
It's annoying.
I know you can do it without frames because I have seen sites such as Runescape.com do it.
I would like to learn to do it to.
OK then you just answered your own question, go look up how to use frames. w3schools.com is a good resource.
It should be made impossible to do this. The fact that it can be done is a way crackers can sneak into computers.
I dont want to use frames though.....
Though I may do it if It wont allow me otherwise.
But I know you can do it without frames because runescape does it.
Sorry buddy but they do use frames.
If pages don't have different URLs, the web servers can't tell them apart.
How do I make my pages the same URL.
Cus when you save them the file name is what the URL is.
example file is contact
www.example.co.uk/contact
How do I do it so they are all the same.
Thanks
I already answered your question, you must use frames. Though you though that Runescape wasn't using frames they are.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.