如何在每个页面的地址栏中保持相同的 url? [英] How can I keep the same url in the address bar for every page?

查看:34
本文介绍了如何在每个页面的地址栏中保持相同的 url?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 Codeigniter 构建的网站,其中有很多页面和目录.

I have a site built with Codeigniter where there are a lot of pages and directories.

假设站点名称是 www.example.com(这是索引页).如果用户转到另一个页面,例如单击关于"链接,我如何才能使所有页面的地址栏中的站点名称​​不更改?

Let's say the site name is www.example.com (this is the index page). If the user goes to another page, for example clicking on the "about" link, how can I make the site name not change in the address bar for all pages?

推荐答案

这是一个坏主意,如果没有别的,它会阻止用户为您的网站添加书签.

That is a bad idea if for nothing else then that it prevents users from being able to bookmark your site.

有两种方法可以做到这一点,但是,如果您打算朝着这个方向发展(我真的建议您现在回头,以免为时已晚).您可以在 iframe 中加载所有内容:

There are two ways to do this, however, if you are intent on this direction (and I really do suggest that you turn back now before it is too late). You can load everything in an iframe:

<!-- your site might look like this then -->
<html>
   <body><iframe src="http://path.to.your.real.site" />
</html>

src 属性将指向其他一些实际包含所有动态 URL 的 URL.

And the src property would be directing to some other URL which actually has all of the dynamic URL's.

您的另一个选择是 AJAX.不过,这对于一个例子来说真的太长太复杂了.

Your other option is AJAX. That is really too long and complicated for an example though.

这篇关于如何在每个页面的地址栏中保持相同的 url?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆