2

I'm building my blog, I have done everything perfectly, but when it came to linking two pages, it gave me this error

error loading page

however, I have made sure that all my files are in the same directory!

<ul class="flex-lg flex-lg-row justify-content-lg-center align-content-lg-center">
    <li class="current-menu-item"><a href="index.html">Home</a></li>
    <li><a href="travelling.html">Travelling</a></li>
    <li><a href="health.html">Health</a></li>
    <li><a href="#">Photos and videos</a></li>
    <li><a href="#">about me</a></li>
    <li><a href="contact.html">Contact</a></li>
</ul>

here is my code

what is the problem?

Jon P
  • 19,442
  • 8
  • 49
  • 72
aman
  • 17
  • 4
  • Well, your code is correct. What is the error message? – Gosi Feb 05 '20 at 05:42
  • error loading page – aman Feb 05 '20 at 05:43
  • what are you using to build this in? It might be breaking on the lack of closing tag if it's trying to check the validity of your code – Aaron Lavers Feb 05 '20 at 05:44
  • from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. – aman Feb 05 '20 at 05:44
  • actaully there is a closing tag but i forgot to mention it in the post – aman Feb 05 '20 at 05:45
  • 1
    https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local – Gosi Feb 05 '20 at 05:45
  • Are you using any server side programming language or a CMS? Try uploading this to your local machine and see if it works. – Gosi Feb 05 '20 at 05:46
  • " it gave me this error". What is "it"? Typically web apps like blogs use more than 1 technology in their stack, the origin of this error is unclear. All you've included is HTML, and typically HTML doesn't have "errors" and is in fact known for being quite fault-tolerant – Hymns For Disco Feb 05 '20 at 05:48
  • im not using any server yet, I'm just building it for practicing my programming! – aman Feb 05 '20 at 05:48
  • the error is " error loading page" – aman Feb 05 '20 at 05:50
  • from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. jquery-1.9.1.min.js:5 GET file:///C:/Users/travelling.html net::ERR_FAILED – aman Feb 05 '20 at 05:51

3 Answers3

1

Hi your code is correct and you are saying that you will getting an error. In my point of view this type of errors occurs when you will made changes in your .htaccess file. if you made changes in your .htaccess file this code will help you

Replace this :-

<li class="current-menu-item"><a href="index.html">Home</a></li>
<li><a href="travelling.html">Travelling</a></li>
<li><a href="health.html">Health</a></li>
<li><a href="#">Photos and videos</a></li>
<li><a href="#">about me</a></li>
<li><a href="contact.html">Contact</a></li>

To this :-

<li class="current-menu-item"><a href="/index.html">Home</a></li>
<li><a href="/travelling.html">Travelling</a></li>
<li><a href="/health.html">Health</a></li>
<li><a href="#">Photos and videos</a></li>
<li><a href="#">about me</a></li>
<li><a href="/contact.html">Contact</a></li>

If these changes not working so use this code

<li class="current-menu-item"><a href="index">/Home</a></li>
<li><a href="/travelling">Travelling</a></li>
<li><a href="/health">Health</a></li>
<li><a href="#">Photos and videos</a></li>
<li><a href="#">about me</a></li>
<li><a href="/contact">Contact</a></li>

Or you will not made changes in your .htaccess file so you also try this code.

Hope this will help you.

Thank you.

  • @aman, I'll try to give you correct answer wait for another answer :-) –  Feb 06 '20 at 10:31
  • Can you give me the url of this project I have an solution and I want to analyse the code and want to find exact problem or and I'm sorry for late reply –  Feb 11 '20 at 13:19
  • I'm sorry but this project i haven't uploaded offıcially to the intwrnet,, however if you want i can send it to you by email – aman Feb 12 '20 at 15:47
1

your code is correct, you made changes in your .htaccess file. remove .php, .html, .htm extensions with .htaccess.

try this code

<li class="current-menu-item"><a href="index">Home</a></li>
<li><a href="travelling">Travelling</a></li>
<li><a href="health">Health</a></li>
<li><a href="#">Photos and videos</a></li>
<li><a href="#">about me</a></li>
<li><a href="contact">Contact</a></li>
  • doesnt work too! and it gave me this error in the console: from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https – aman Feb 05 '20 at 13:20
1

Finally this help you

I only add website main url before files in anchor tag.

<li class="current-menu-item"><a href="https://yourwebsite.com/index.html">Home</a></li>
<li><a href="https://yourwebsite.com/travelling.html">Travelling</a></li>
<li><a href="https://yourwebsite.com/health.html">Health</a></li>
<li><a href="#">Photos and videos</a></li>
<li><a href="#">about me</a></li>
<li><a href="https://yourwebsite.com/contact.html">Contact</a></li>