html - JavaScript window.location function not working in localhost folder -


in htdocs directory of xampp have created list directory , place simple index.html file in it.

the file contain

<!doctype html> <html>    <head>   <script>         function redirect() {         alert("file:///d:/xampp/htdocs/");            window.location="file:///d:/xampp/htdocs/";         }   </script> </head>     <body onload="redirect();">    </body> </html> 

when navigate localhost/list/ showing blank page, , when have open directly browser it's working fine.

is there restriction url "file:///d:/xampp/htdocs/".

i want see file structure file:// url.

you can try one:

<script>         function redirect() {         alert("../xampp/htdocs/");            window.location="../xampp/htdocs/";         }   </script> 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -