I'm looking to use the html anchor tag to jump to a different page on my site. Is that possible? All info I find only talks about doing it within the same page.
I have a page with options and another page with those options in detail. When they are taken to the second page, I want the option they chose to be at the top of the page, instead of them having to scroll down to find it.
You can use hash to navigate to a different page, e.g. from "
page1.html" to "
page2.html#name1" via a generic anchor tag with the url in the 'href' attribute.
However that will not retain the options from the first page unless you are using:
- cookies to store/retrieve the options
- server-side mechanism to store/populate the options
- form submission or HTTP_POST to the second page
Sure it's possible, if pageB.html has a series of containers that each have information in them, and an id like info1, info2, info3 etc, then you can set the fragment at the end of each option link on pageA.html like this:
So if there are 30 different sets of info on pageB.html and the info30 container would be right at the bottom, if someone clicks the link for info30 on pageA.html when pageB.html loads, info30 will be at the top. It will still be below all of the other info boxes, but the page will automatically be scrolled to the the container id...
The http request will automatically 'know' which info link was clicked from the href. You don't need to implement any state-saving mechanism for this.
See this test page for an example...
you should also read this if you need some more informations about links and anchors in html
So it's not possible at all, with just simple html?