Error 6 (net::ERR_FILE_NOT_FOUND): The file or dir

2019-06-28 03:19发布

问题:

hi there i am a student and practicing how to place the like box plugging code in simple html using the notepad, here is the simple code i write with the like box plugging code:

<html>
    <head>
      <title>My Great Web page</title>
    </head>
    <body>
<iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Febitesblog&amp;width=292&amp;colorscheme=light&amp;show_faces=true&amp;border_color&amp;stream=true&amp;header=true&amp;height=590" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:292px; height:590px;" allowTransparency="true"></iframe>
    </body>
 </html>

and when i try to execute in browser it says: This webpage is not found No webpage was found for the web address:

file://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Febitesblog&width=292&colorscheme=light&show_faces=true&border_color&stream=true&header=true&height=590
Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found

hope guys it will fix my problem thank you :)

回答1:

It's failing because the // in that is protocol relative meaning it loads the link/photo/like box/whatever using the same protocol used to access the page itself.

  • When accessing the page over HTTP (http://), the Like Box will be included over HTTP
  • When accessing the page over HTTPS (https://), the Like Box will be included over HTTPS

You're accessing a file on localhost, via the file protocol (file://) - which means it tries to include the Like box the same way, which is not valid since there isn't a file on your machine called 'www.facebook.com`

Use <iframe src="https://... now, and change it back to <ifame src=//... when you're uploading to your server



回答2:

<iframe src="//www.facebook.com/plugins/likebox...

should be...

<iframe src="https://www.facebook.com/plugins/likebox...