当用户在页面上或页面外冲浪时,如何在浏览器的“地址"字段中获取文本以进行更改? [英] How do I get the text in the adress field in the browser to change when the user surfs on and outside of the page?

查看:116
本文介绍了当用户在页面上或页面外冲浪时,如何在浏览器的“地址"字段中获取文本以进行更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确定这是一个新手问题,希望社区能够原谅我不知道这个问题(或不知道合适的搜索词来解决我的问题).

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).

因此,这很重要:我正在运行一个带有少量访问者的小型网页.我已经用HTML和CSS编写了整个页面,并将其托管在我的私有DropBox中( http://dl.dropbox.com/u/3394117/Hemsida/Psykofil/Index.html ).

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).

我已经从Loopia(

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.

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

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.

我可能应该提到,在Loopia进行域名配置时,我的选项(从瑞典语免费翻译)如下:

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
  • 停车
  • 转发(我当前正在使用的那个)
  • 发送到外部URL
  • (无法提供,因为我没有Loopia的网络酒店)指向帐户中的另一个域.
  • (因为我没有Loopia的网络酒店,所以无法使用).拥有自己的网页首页文件夹.

推荐答案

这是因为您的页面位于<frameset>内部,因此地址栏永远不会更新.

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

您说我已将该域定向到上面引用的index.html文件."听起来您已经设置了域转发".框架集通常是技巧"主机用来保持相同URL的-将要转发"到的页面嵌入框架集.称为域屏蔽".有关其工作方式的说明,请参见 http://www.hostingmultipledomainnames.com/domainforwarding.htm .

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.

如果您将实际的html文件上传到您的网站根目录,则可以解决问题.如果您不确定该怎么做,而您又是新的网站站长,则可能需要与您的网络托管服务商联系.否则,如果您想拥有该域,但将文件保留在保管箱帐户中,则我相信您的选择会变得很复杂(诸如反向代理之类的东西).

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).

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

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.

过程如下:

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

  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.

您购买了一个虚拟主机帐户.或者,您可以将文件上传到可免费访问的可公开访问的服务器.然后,您上传所有内容.

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.

这是您缺少的部分.现在,您需要将域名与主机帐户进行关联.当您通过一家公司购买域名和虚拟主机帐户时,通常无需您干预即可实现.

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.登录到您的域名注册商,然后将域名指向您的网络托管帐户的服务器.这是向Internet发出的信号-嘿,当您输入域名"http://ssss.com"时,请转至该服务器.

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.登录到您的虚拟主机帐户,然后将域名寄存"到您的帐户中.乍一看这可能很难理解,但是从根本上说,只是在输入域名时告诉Internet转到该服务器或该服务器不是很有用. 如果这是我们所需要做的,那么我只需注册 http://my-amazon.com 并指向我的域到Amazon.com.然后人们可以以 http://myamazon.com 的身份浏览Amazon.com,而我可以通过出售这个现在非常受欢迎的域名来致富

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.

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

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.

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

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.

缺点是,您目前没有允许您寄存域名的虚拟主机.好处是您每年可以节省约60-100美元(在瑞典可能或多或少),这是基本的共享"托管帐户的费用.

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.

您可以决定是否拥有独特的网页(http://psykofil.org/contact.html等),对于您来说是否值得,或者现在是否可以使用价格低廉的低成本解决方案来解决?完美,但至少允许人们访问您的网站.您提出的内容实际上很酷,但确实有一些局限性.

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.

最后::如果您确实想购买服务器空间以便可以托管您的网站,那么在价格和服务都不错的情况下,通过Loopla进行购买就比较容易了. .通常,在购买时可以选择将帐户链接到您已注册的域名.然后,您要做的就是使用 Filezilla 这样的FTP程序将您的内容上传到您的帐户,完成.

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.

这篇关于当用户在页面上或页面外冲浪时,如何在浏览器的“地址"字段中获取文本以进行更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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