当用户在页面内外冲浪时,如何使浏览器地址字段中的文本发生变化?

发布于 2024-11-27 20:35:05 字数 943 浏览 3 评论 0原文

我确信这在某种程度上是一个新手问题,我希望社区能够原谅我不知道这一点(或者不知道解决我的问题的适当搜索词)。

所以,事情是这样的:我正在运行一个只有少量访问者的小网页。我自己用 HTML 和 CSS 编写了整个页面,并将其托管在我的私人 DropBox 中 (http://dl.dropbox.com/u/3394117/Hemsida/Psykofil/Index.html)。

我从 Loopia 购买了域名“www.psykofil.org” (www.loopia.se),我已将此域定向到上面引用的 index.html 文件。

现在,这就是我想要发生的事情:页面上有三个不同的位置可供您访问(您可以通过左侧的菜单选择要访问的位置)。单击其中一个链接时,会将用户带到另一个 .html 文件。我希望发生的是,这可以在地址字段中看到,因此当他或她单击“x”时,顶部应该显示 www.psykofil.org/x。此外,当他或她通过超链接离开网页时,我希望地址字段更新以显示新位置。现在,无论用户做什么,地址字段中总是显示 www.psykofil.org。

我可能应该提到,当我在 Loopia 上配置我的域名时,我的选项(从瑞典语自由翻译)如下:

  • DNS
  • 停放
  • 转发(我当前正在使用的)
  • 发送到外部 URL
  • (不可用,因为我没有带有 Loopia 的网络酒店)指向帐户中的另一个域。
  • (不可用,因为我没有带有 Loopia 的网络酒店)自己的网页主文件夹。

This is somewhat of a newbie question I'm sure and I hope the community will excuse me for not knowing this (or not knowing the appropriate search terms to resolve my question).

So, this is the deal: I'm running a small webpage with a small amount of visitors. I've written the whole page in HTML and CSS myself and I host it in my private DropBox (http://dl.dropbox.com/u/3394117/Hemsida/Psykofil/Index.html).

I've bought the domain name "www.psykofil.org" from Loopia (www.loopia.se) and I've directed this domain to the index.html file referenced to above.

Now, this is what I want to happen: I have three different places you can go to on the page (you choose where to ge through a menu on the left). When one of these links is clicked, it takes the user to another .html-file. What I would like to happen here is that this is seen in the adress field so when he or she clicks on "x", it should say www.psykofil.org/x on top. Also, when he or she navigates away from the webpage through a hyperlink I would like the adress field to update to show the new location. Right now, no matter what the user does, it always says www.psykofil.org in the adress field.

I probably should mention that my options (freely translated from swedish) when I go to the configuration of my domain name at Loopia is the following:

  • DNS
  • Parking
  • Forwarding (the one I'm currently using)
  • Send to an external URL
  • (Unavailable because I don't have a web hotel with Loopia) Point to another domain in the account.
  • (Unavailable because I don't have a web hotel with Loopia) Own homefolder for webpage.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

时间海 2024-12-04 20:35:05

这是因为您的页面位于 内,因此地址栏永远不会更新。

您说“我已将此域定向到上面引用的index.html 文件。”听起来您已经设置了“域转发”。框架集通常是主机用来保持相同 URL 的“技巧”——将您“转发”到的页面嵌入到框架集中。这称为“域屏蔽”。有关其工作原理的说明,请参阅 http://www.hostingmultipledomainnames.com/domainforwarding.htm

如果您将实际的 html 文件上传到站点根目录,应该可以解决问题。如果您不确定如何执行此操作并且您是新网站管理员,则可能需要与网络托管服务商的支持人员联系。否则,如果您想拥有该域,但将文件保留在您的保管箱帐户中,我认为您的选择会变得复杂(例如反向代理)。

更新:
通常,当人们创建网站时,他们会做三件事:注册域名、购买网络托管帐户,然后将其域名与托管帐户关联。您已经完成了第一部分,并找到了管理第二部分的巧妙方法,但您还没有完成第三部分。

过程如下:

  1. 您注册您的域。也就是说,您每年支付 10-30 美元即可获得特定域名的专有权。注册域名意味着当人们在浏览器中输入“http://mysite.com”时,您的域名将会出现。然而,它只是一个占位符 - 那里没有任何实际内容。您的所有文件和图像都需要上传到服务器才能让人们看到。

  2. 您购买了一个网络托管帐户。或者就您而言,您将文件上传到可公开访问的服务器,这具有免费的优点。然后您上传所有内容。

  3. 这是你所缺少的部分。您现在需要将您的域名与您的托管帐户关联。当您通过一家公司购买域名和网络托管帐户时,通常会在无需您干预的情况下发生这种情况。

    但是,如果您单独获取它们,则需要做两件事:

    a.登录您的域名注册商,并将域名指向您的网络托管帐户的服务器。这是向互联网发出的信号 - 嘿,当您输入域名“http://ssss.com”时,请转到该服务器。

    b.登录您的网络托管帐户并将域名“停放”在您的帐户中。一开始这可能很难理解,但基本上,在输入您的域名时告诉互联网转到这个或那个服务器并不是很有用。
    如果这就是我们需要做的,我只需注册 http://my-amazon.com 并指向我的域名到亚马逊网站。然后人们可以通过 http://myamazon.com 浏览 Amazon.com,而我可以通过出售这个现在非常受欢迎的域名来致富.

    但这行不通。为了让我能够通过我的域名实际浏览网络托管帐户,我需要将域名“添加”到我的托管帐户中。 Dropbox 不允许您这样做。这是一个文件共享系统,您可以巧妙地将其用作网络主机。但是,您永远无法登录 Dropbox 并将您的域名停放在那里,因为他们不是这样做的。

    总结:你可以把这个过程想象成篮球中的传球。您可以通过将用户发送到服务器来扔球,但服务器必须接住球。为了接住球,发球者需要知道球即将到来。

    您的域名注册商通过向其自己的服务器添加一个页面来“伪造”此过程,该页面链接到“http://dl.dropbox.com/yourpage/etc/etc/Index.html”。这样,您的域名注册商就不必担心托管您的所有内容以及技术支持和服务器空间的麻烦。

    缺点是,您目前没有允许您停放域名的网络主机。好处是您每年可以节省大约 60-100 美元(在瑞典可能或多或少),这就是基本“共享”托管帐户的成本。

    您可以决定拥有不同的网页(http://psykofil.org/contact.html”等)对您来说是否值得,或者您现在是否适合使用非常低成本的解决方案”虽然并不完美,但至少允许人们访问您的网站。您的想法实际上非常酷,但它确实有一些限制。

    最后:如果您确实想购买服务器空间以便托管您的网站,那么通过 Loopla 购买会不会那么麻烦,而且价格和服务都不错。通常,您在购买时可以选择将您的帐户链接到已注册的域名。然后您需要做的就是使用 Filezilla 之类的 FTP 程序将您的内容上传到您的帐户,然后您就可以重新完成。

That's because your page is inside a <frameset>, so the address bar will never update.

You say "I've directed this domain to the index.html file referenced to above." It sounds like you've set up 'domain forwarding.' Framesets are often the 'trick' hosts use to keep the same URL - embedding the pages you're 'forwarding' to in a frameset. It's called "domain masking." See http://www.hostingmultipledomainnames.com/domainforwarding.htm for a description of how it works.

If you upload your actual html files to your site root, that should do the trick. If you're not sure how to do that and you're a new webmaster, you may want to be in touch with your web host's support. Otherwise, if you want to have that domain, but keep your files in your dropbox account, your options I believe get complicated (things like reverse proxies).

UPDATED:
Typically, when people create a website, they do three thing: register a domain, buy a web hosting account, and then associate their domain with their hosting account. You've done the first part, and have found a clever way of managing the second part, but you haven't done the third part.

The process is like this:

  1. You register your domain. I.e., you pay $10-30 a year for the exclusive right to a given domain name. Registering the domain means that when people type 'http://mysite.com' into their browser, your domain will come up. However, it's just a placeholder - there isn't any real content there. All your files and images need to be uploaded to a server in order for people to see them.

  2. You purchase a web hosting account. Or in your case, you upload your files to a publicly-accessible server, which has the advantage of being free. You then upload all your content.

  3. This is the part you're missing. You now need to associate your domain name with your hosting account. This typically happens without your intervention when you purchase both your domain name and your web hosting account through one company.

    However, if you acquire them separately, you need to do two things:

    a. Log in to your domain registrar and point the domain name to your server for your web hosting account. This is a signal to the Internet - hey, when you type in the domain name 'http://ssss.com', go to this server.

    b. Log in to your web hosting account and "park" the domain at your account. This may be hard to understand at first, but basically, just telling the Internet to go to this or that server when typing in your domain name isn't very useful.
    If that's all we needed to do, I could just register http://my-amazon.com and point my domain to Amazon.com. Then people could surf Amazon.com as http://myamazon.com and I could get rich from selling this now incredibly popular domain.

    But that doesn't work. In order for me to actually browse the web hosting account through my domain name, I need to "add" the domain name to my hosting account. Dropbox doesn't let you do that. It's a file-sharing system, which you've cleverly used as a web host. However, you'll never be able to log into Dropbox and park your domain there, because that's not what they do.

    Summary: You can think of this process like a pass in basketball. You can throw the ball by sending the user to a server, but the server has to catch it. In order to catch the ball, the server needs to know it's coming.

    Your domain registrar is 'faking' this process by adding one page to its own server, which links to "http://dl.dropbox.com/yourpage/etc/etc/Index.html". This way, your domain registrar doesn't have to worry about hosting all your content and the headaches of technical support and server space.

    The downside is, you don't have a webhost that allows you to park a domain at the moment. The upside is you're saving about $60-100 per year (it might be more or less in Sweden), which is what a basic "shared" hosting account would cost.

    You can decide if having distinct webpages (http://psykofil.org/contact.html" etc), is worth it for you, or whether you're fine for now with the very low-cost solution that isn't perfect but at least allows people to access your site. What you've come up with is actually pretty cool, but it does have some limitations.

    Finally: If you do want to go ahead an buy server space so you can host your site, it will be less of a headache to buy it through Loopla, if the price and service are good. Typically, you are given the option when making the purchase of linking your account to your already-registered domain name. Then all you need to do is use an FTP program like Filezilla to upload your content to your account, and you're done.

笑红尘 2024-12-04 20:35:05

看来您的主机正在“屏蔽”URL,这意味着位于“www.psykofil.org”的实际index.html页面实际上是将通过dropbox定位的索引页面加载到“iframe”中,因此您的主URL不会改变以反映变化。

解决方案:将文件上传到主主机,然后将具有 iframe 的默认索引文件更改为 dropbox 索引文件。

It seems your host is "masking" the URL, meaning actual index.html page located at "www.psykofil.org" is in fact, loading your index page located via dropbox into an "iframe" , hence your main URL does not change to reflect the changes.

Solution: Upload your file to your main host and change the default index file that has iframes with the dropbox index file.

翻了热茶 2024-12-04 20:35:05

我相信这是因为您使用的是frame。如果您只是链接到其他 html 页面(即 About page),那么地址栏就会更新。

I believe it's because you're using frames. Were you to simply link to the other html page(i.e <a href="about.html">About page</a>) then the address bar would update.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文