ID # reference without index.html [duplicate] - html

This question already has answers here:
Reference: mod_rewrite, URL rewriting and "pretty links" explained
(5 answers)
Closed 5 years ago.
long time lurker first time signup and poster.
quiet simple really
how do i reference from the navigation page/index.html#id to just page#id
- so i dont want it to show index.html
ie.
ww.page1.com/pasture#clover
i am currently using the codes below, and dont mind if i need to put in some other code. the pages will be in .php later on but for now in html.
I am using the below codes
Clover
from the navigation on the first page/all pages
<h3 id="clover">Clover</h3>
and this on the target page

What you want: Anchors (or Bookmarks)
Look here: https://www.w3schools.com/html/html_links.asp
So: Use Clover
Also: If you call the site as www.abc.de/index.html#123, then it will stay as it is - and give you www.abc.de/index.html#clover.
If you call the site as www.abc.de/#123, then it will also stay as it is - and give you www.abc.de/#clover.
Edit: I misunderstood the OP. I may edit this post later. Sorry.

Related

Simply transfer HTML code into other HTML files [duplicate]

This question already has answers here:
Multiple webpages with common title and navigation bars
(4 answers)
Closed 2 years ago.
I would like to start a homepage for me. Every time I add a thing to index.html I have to add it to the links (in about.html etc.) as well.
How can I simplify that, that the new things of the index.html are automatically transferred directly into the other links (about.html etc.)?
Thanks for the help
The solution I used was to create a JS script that you would include in your HTML, that would add the HTML you want to the document :
let body = document.getElementsByTagName("body")[0];
body.insertAdjacentHTML("beforeend", "your html");
You could then put this script where you want to include the HTML.
I don't know if it's the best solution, but it works.
Right now, using vanilla HTML, there is no quick, easy, and simple way to do this. Using a backend framework like Django, this is easy, but that is really complicated and takes a while to learn!

URL Actions from URL only [duplicate]

This question already has answers here:
How do I add target="_blank" to a link within a specified div?
(7 answers)
Closed 6 years ago.
A quick question regarding URL target actions.
Is there a way to specify the target action of a URL within the URL?
Context: I can't edit the underlying code where links live in this particular instance, but I have full control over the links themselves. I'd like to be able to specify a link target (new tab, new window, same tab, etc) from a URL itself.
If that's possible, awesome!
If that's impossible, darn (and thank you for enlightening me).
There's no reliable way as far as I'm aware (it's a security concern). If you only have control of the URL because you're using some other system (you're not the admin), chances are the link is escaped for javascript. If it isn't:
Some link

Removing a / from the address bar? [duplicate]

This question already has answers here:
Removing trailing slash from ALL URLs in site
(3 answers)
Closed 8 years ago.
I've always seen this on websites but I've never actually known how to do it. If the title is unclear then here is what I mean.
http://domain.com/directory/
I want to change that into:
http://domain.com/directory
I've seen other websites do it and I just wondered how I would go about doing that. Not even sure if this is the correct place to be posting this but I have no idea. If I am posting in the wrong place then please direct me to somewhere else. Thank you.
It is good for the SEO and it will set default to the root of your domain on the server where you have uploaded the web pages. It is something you don't need to worry about. It pretty much gets the search engines to look at all the files and not just the index.html file

Menu from external file [duplicate]

This question already has answers here:
What are the new frames? [closed]
(3 answers)
Closed 9 years ago.
I am now making a webpage and need a bit of help. Its been some time since Ive done my last page a few years ago. Back then I remember it was quite popular to use frames, but these days, this is basically no longer used.
What I used to do is have a horizontal menu on the top as a frame, and underneath it the content frame.
Now, currently I have a webpage again, where I would like to place a horizontal menu on the top of the page.
The menu is written in pure CSS and HTML. The CSS is loaded from an external file, but the problem I now have is that the menu is basically a DIV element, which however I have to put into each page separately.
I was just wondering there must be a way of making this simpler and have it somehow inserted from an external file again - sorry maybe it sounds confusing, but basically I am looking for an alternative of the frames used in the past. Many pages have menus and I am sure they do it somehow, because if I make a change in the menu, I dont want to be making these changes on all the hundreds of pages.
I dont ask for any specific coding etc. I can google that myself if I dont know how to do it, but I just need a general recommendation how to solve this. Just to summarize, the menu is in HTML+CSS and the pages are mostly PHP, some of them HTML.
I'd think it would mostly depend on the framework. You could just have one page, and use AJAX to load the content of each page, or you could have several php pages, all of which call some function at the beginning to set up the header, or you could use a ASP.NET master page or whatever your framework uses.
If you're using PHP, then the easiest way would be :
<?php include('my_page.html'); ?>
Be carefull of the path to your html page

How does facebook know what image to use when you post a link? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How does Facebook detect images when adding a link?
hi all, curious how facebook is able to pull an accurate image when you post a link. I know they first look for a meta tag with the image the site owner wants them to use but if that doesn't exist what logic do you think they do to get what image should be presented if you link to a blog article let's say.
They most likely grab the source of the page and analyze it to extract the biggest images. They probably look for images close to the center of the page, images that are prominent. It's also possible that they analyze other similar pages on the site to determine unique images that aren't common across pages (this would help FB rule out images used for navigation, headers, decoration, etc.) Not sure how it determines how many perspective images to grab, though.