my folder structure is as follows:
sample/register
i have a file in sample folder named index.html .i want to redirect to this file from a file within register folder.how can i do that? this is what i have done.But the problem is that i have a file within register folder named index.html and its getting redirected to this folder.how do i mention the root folder?
<li><a id="register" href="index.html">Back</a></li>
Depending on where your root folder is href="/index.html" may work or just going up one folder with href="../index.html"
Related
I have a folder called files with the following content:
Index.js
Style.css
Explorer.js
How can I iterate through the content of the folder to check if it has a file called index.js. If it has such file, console.log ("folder has index.js!").
I have a folder named "myWebsite".
Inside that folder I have "index.html" and another folder named "other". Inside "other" I have CSS files JS files and "page2.html". I have linked all files with my "index.html". But when I am in "page2.html", I want a link that will lead me to "index.html".
go back
In order to navigate back you should use '../' if you want point two folders back you can use '../../' for instance.
In this case, within Page2.html use:
<a href="../index.html">go back<a>
NOTE: You have an extra dot.
Based on what you wrote, this should fix it:
link
The ../ directory references the parent directory.
Examples:
<a href="sample.html"> The "sample.html" file is located in the same folder as the current page.
<a href="pages/sample.html"> The "sample.html" file is located in the pages folder in the current folder.
<a href="/pages/sample.html"> The "sample.html" file is located in the pages folder at the root of the current web.
<a href="../sample.html"> The "sample.html" file is located in the folder one level up from the current folder.
See here for more on HTML filepaths.
I have a js file which contains some data, in the public directory. And I want to change them even after the building. And I don't like to build every time I change that file. How can I import that data.js file without getting "Relative imports outside of src/ are not supported." error.
The project was created using create-react-app.
You need to include it using a script tag in the index.html file in your public folder.
I have been using Vue for a while now, and I noticed that I can store project images in either the assets folder or the public folder.
To access images from assets folder in Vue, one would do :src="require('#/assets/images/myimage.jpg')"
To access images from public folder in Vue, one would do :src="./static/images/myimage.jpg"
What's the proper location to store Vue project images?
What's the implication of using either?
How do they affect my project?
Based on the official vue documentation everything that is within the assets folder will be handled by Webpack while everything in the public folder is simply copied but doesn't go through Webpack: https://cli.vuejs.org/guide/html-and-static-assets.html#static-assets-handling
So if you want to take advantage of Webpacks optimization features during build (which you most certainly want) put them in assets.
I also put all my img's in the assets folder and only have the pwa related images and icons within the public folder.
All Stuff in the public folder gets straight up copied to your /dist usually. ex: favicon.ico ends up on your /dist folder with the name... favicon.ico.
The assets folder is usually where you would put your images/videos/fonts/svgs etc that you will import within vue files. These files end up on your /dist folder as a file with a hash name: (ex: 5j2i35j2o251hia.png).
Any assets from the /assets folder that you do not explicitly import will not end up in your /dist folder, as to not bloat your final file size.
Hope this helps..
https://cli.vuejs.org/guide/html-and-static-assets.html#static-assets-handling
Different between both would be relative (eventually as require('image')) vs absolute paths. Usually absolute path will not be passed via webpack during the build. And if you optimize images of absolute path, nothing will happen.
I have dragged a folder named mydocs and selected the "create folder references." option in coy menu.
Here is my folder hierarchy.
|- mydocs
|- newfolder
|- anothernewfolder
|- js
|- main.js
|- view
|- html
|- index.html
I have to call the main.js file from index.html file.
For now I am using the absolute path "user/...../mydocs/newfolder/anothernewfolder/js/main.js"
for including the file. It works like charm on simulator but when I run this on device I doesn't gets called.
How to call the .js files from the .html file residing in different directories?
After searching over the internet I found this answer in this post and by looking at it
../../anothernewfolder/js/main.js worked for me as .. means up one directory and . means current directory.
So I have to go up two time for finding the directory of the .js files.
But I am unable to find how the .js file can refer to another .js file of different directory?
try to use the following code in your index.html
../anothernewfolder/js/main.js
You need to call main.js like this in index.html in view folder:
<script type="text/javascript" src="../anothernewfolder/js/main.js"></script>