简体   繁体   English

HTML 链接不起作用

[英]HTML Links are not working

I am currently creating a website, and for some reason a simple task linking to another web page is not working.我目前正在创建一个网站,但由于某种原因,链接到另一个网页的简单任务不起作用。 When I try and link something I get当我尝试链接一些东西时,我得到了

This webpage is not found.找不到此网页。 No webpage was found for the web address: C:\\me\\me\\me etc etc".未找到该网址的网页:C:\\me\\me\\me 等”。

All I am trying to do is link a work to another page on my web page.我要做的就是将作品链接到我网页上的另一个页面。 Here is my code:这是我的代码:

<a href="C:\\users\rob\website\page.html">page link</a>

I have also just tried linking google and amazon and get the same results.我也刚刚尝试链接谷歌和亚马逊并获得相同的结果。

<a href="file://C:\users\rob\website\page.html"> page link </a>

Also, You cannot load local resources using file:// if the page is hosted on a webserver .此外,如果页面托管在webserver上,则无法使用file://加载本地资源。 That would be a security issue and is hence, forbidden.这将是一个安全问题,因此被禁止。

Your script console will, in that case also contain:在这种情况下,您的脚本控制台还将包含:

Not allowed to load local resource: file:///C:/users/rob/website/page.html 

You're not closing the quote on the link.您没有关闭链接上的报价。 Try <a href="URL goes here" > page link </a>试试<a href="URL goes here" > page link </a>

For instance, <a href="http://www.google.com/" > Google </a>例如, <a href="http://www.google.com/" > Google </a>

Also, remember that "C:..." is not a web address, if you want to test locally, try using the file:// prefix.另外,请记住“C:...”不是网址,如果您想在本地进行测试,请尝试使用file://前缀。

For instance, <a href="file://C:\\me\\me\\me\\page.html" > My Page</a>例如, <a href="file://C:\\me\\me\\me\\page.html" > My Page</a>

You forgot the second "你忘了第二个“

try this:试试这个:

<a href="C:\users\rob\website\page.html"> page link </a>

试试这个,

 <a href="file:///C|\users\rob\website\page.html" > page link < /a>

Try <a href = "../foldername/filename" > </a>试试<a href = "../foldername/filename" > </a>

../ Defines the root. ../ 定义根。 when you use this style it searches for the file location from the root.当您使用此样式时,它会从根目录搜索文件位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM