a href doesn't work in my project - html

I have a simple problem with my <a href=""> code: they don't open anymore...
It only worked one time, and then no more.
I don't know why... It would be great if someone can help me with this.
my code:
<div data-role="page" id="p1">
<div data-role="header" data-theme="a" data-position="fixed" data-id="footer">
Home
</div
I tried a lot of things, but I didn't find out what the problem is.

It looks like you are experiencing a combination of broken paths and jQuery Mobile's overriding of link behavior.
On the first load you are in the folder containing the sub-folder Destaque, after you click on it your reference directory is Destaque so clicking on it again would try and resolve Destaque/Destaque/Destaque.html. This behavior might not look like a a classic 404 because of jQuery Mobile (it uses ajax to load pages).
To fix this use an absolute path by adding a leading / changing this:
Home
to this:
Home
This assumes that this sub-folder is in fact in the root of your web app. If not then you need to adjust your absolute path.

Ok. i have find the answer for this problem.
the path i have written was right and the problem was not the relative/absolute path.
the only thing i have to add to this link is rel="external", because the html page that i want to open is in the sub-folder from my projecto.
the following code show the right code for this situation.
Home

Related

How to embed HTML iFrame into mkdocs/material?

I'd like to embed an HTML file into an MkDocs/Material page.
I'm trying something like what's below, but getting a 404 error.
Any idea of the right way to do this?
<div class="map">
<iframe src="map.html"></iframe>
</div>
For what it's worth, a link like this does work, but I'd like the option to embed it in the current page.
[Show a map](map.html)
404 error seems that map.html is located somewhere else, while [show a map](map.html) may generate correct link. map.html is relative to viewing page, so I recommend to:
get absolute url of map.html file, e.g. When you click on Show a map what is absolute URL in browser location bar?
put that absolute URL into iframe src="absolute url"
you may make the absolute url relative - based on address current address in location bar
Actually the index.md files behave differently. Relative paths work with them, but I also found a workaround for keeping it at relative paths: I went up one level to root then I used it as if it in the folder that gets generated in the site folder when you run mkdocs build See it in my sample docs here: https://agu3rra.github.io/volpy/ Link to the repo is on the top right corner.
Cheers!

My CSS and images aren't loading once the HTML file is hosted on a server. Why?

I am hosting the website on a home server so we aren't going through a third party. Even though I have the CSS linked, the file in the same area as the HTML, and the images all set up just one file away, nothing is showing up aside form basic HTML.
Please let me know if you've run into this problem of the HTML file working UNTIL it's hosted on our server and how you've fixed it. Thank you!
When I load just the HTML file in my browser (chrome) everything shows up beautifully, but once I try to host it, nothing looks the same.
Here is some of the code I used to link the CSS file and the images just to make sure there's nothing wrong there:
<head>
<title>Alexandra ReganHolzheimer</title>
<link href="pages_style.css" rel="stylesheet" type="text/css"
media="screen">
</head>
And for the images:
<div class="container">
<img src="img/me3.jpg" alt="me" class="logo">
</div>
UPDATE: I think I figured it out. The issue turned out to be that my server didn't like underscores and a lot was case sensitive. Your suggestions were super helpful and put me on the right path.
thank you!
Once u load your URL on browser. Then see the page source. In pagesource please check your css is loading correct or not. If error means please correct it and then load again.
I faced a similar issue when I tried hosting one of my learning projects onto a server.
I fixed it by making all the references relative.
For example:
If your file structure is like:
your_project /
pages_style.css
index.html
img/
Just change your paths, from: img/me3.jpg to ./img/me3.jpg in your index.html.
I hope it helps. :)

Why does my link say unable to find file?

I am working on a project and am making an anchor tag link to another page (just another page on the website). Yet when I do this, it says, "Your file was not found". What could be wrong? Here is what my anchor tags look like
<a id="mission-link" class="link" href=".../Home/index.html#mission">
Thanks for the help and have a great day
You are using 3 dots instead of 2
.../Home/index.html#mission
should be
../Home/index.html#mission
If that still doesn't fix it, then we'd need to know your folder structure to know whether you should actually be moving up a directory or not. .. moves up a directory from where the current file is.

Absolute paths for CSS files in ASP.net

I had an error in my asp website when I deployed it to IIS6 telling me that I cannot use a leading .. to exit above the top directory. I searched around google and viewed similar questions posted here at stackoverflow and saw recommendations to replace my relative paths ... with ~.
Here is the path for my CSS folder:
LMS\assets\css
Where the page is located that tries to access the CSS:
LMS\MasterPages
My project structure:
LMS
-->assets
-->css
-->MasterPages
-->Default.aspx
However, I can't seem to get my paths working. My Default.aspx cannot find my CSS file. Here is an example:
Working:<link href="../assets/css/globalStyles.css" rel="stylesheet" runat="server"/>
Alt 1:href="~/assets/css/globalStyles.css"
Alt 2:href="~\\assets\\css\\globalStyles.css"
Alt 3:href="<%= Page.ResolveUrl("~/assets/css/globalStyles.css") %>"
All of these alternatives don't work. When I debug my site, no styles are present and all are just plain texts. Google Chrome pointed out that my path was being read incorrectly. It was read as:
http://localhost:2981/LMS/Admin/~/assets/css/globalStyles.css.
Can share some thoughts on why this is happening? Why can't my page find my CSS files? I even tried to bind the Page Header in page load but its still not working.
Some ideas? Any help will be greatly appreciated!
You have to resolve the path "~/assets/css/globalStyles.css" using Page.ResolveUrl (WebForms) or Url.Content (MVC) - so your Alt 3 must work. Look at the page html through browser's "View source" - what is href there?
Either -> Url.Content("~/assets/css/globalStyles.css")
Or you can directly use -> href="/assets/css/globalStyles.css"

How to make a picture link with HTML?

I have made a picture link with this code snip:
<a href='feed.php'><img src="C:\xampp\htdocs\Project\Icons\Feed.png"/></a>
But no picture appears on my page, why?
(I'm currently only using my page locally!)
It's because you (are trying to) use a local file reference.
Either use the relative path
or
<a href='feed.php'><img src="file:///C:/xampp/htdocs/Project/Icons/Feed.png"/></a>
Please be aware that if you plan to use this 'online' it will fail because of the LOCAL reference.
If you load the page through your webserver you should use:
<a href='feed.php'><img src="/Icons/Feed.png"/></a>
Or
<a href='feed.php'><img src="http://yoursite.local/Icons/Feed.png"/></a>
Or whatever the path to the image is.
I would prefer the relative path (the first) though which enables you to move your page to another domain without your links / images breaking.
You can't link local files from a remote web page. This is to prevent webpages from accessing files on the end-user's computer.
Change this: C:\xampp\htdocs\Project\Icons\Feed.png
To this: http://yourwebsitehere.com/Project/Icons/Feed.png
EDIT: Since you say its only used locally, then you need to use this instead:
file:///C:/xampp/htdocs/Project/Icons/Feed.png
Also, make sure the image is actually located where you think it is!
Try typing file:///C:/xampp/htdocs/Project/Icons/Feed.png into your browser's address bar and see what happens.