I have a ESP32 running a Web Server controlled by an IPAD.
On the IPAD I have a list of 500 hyperlinks in a column
example item name 1 is associated with 192.168.1.100/1
item name 2 is associated with 192.168.1.100/2 etc.
Each page displays 50 item names. When I select an item name the server refreshes the list
starting with item name 1.
Is there a way that if I select item name 225 that when the server refreshes the page
it jumps to page 5, not to the beginning of the list?
It's easy to calculate the page by using the ip address returned back to the server 192.168.1.100/????, but how do I get the server program to automatically scroll down to page 5.
I'm looking for a simple solution without having to completely rewrite my code.
I guess you mean scrolling down 5 view sizes because I assume the complete list is on one page (otherwise your question doesn't make sense).
Of course you can do a lot of Javascript magic to scroll more or less to that position in the page but usually anchors are used for that and that even works back to HTML 0.9 of 1991.
The IPAD list is very long and you need to scroll down with your finger multiple times to get to the bottom of the list. When you select an item the server refreshes the list back to the beginning.
I can break up the list and use a page up/down buttons to let the server know what page your on or use anchor element to jump back to where the selection is made.
In my application I'm not sure using anchors will work, or how to implement it.
Here is my code that creates the links
void CreateWebPages()
{
int y; // Start of Creating Webpages, one page for each song
for (y = 0; y < i; y++) {
client.print("<a style='text-decoration: none' href='"); // create hyperlink
client.print(y); // subpage to 192.168.1.100
client.print("'>");
client.print(titlesbuffer[y]); // names of songs sent to client
client.print("</a><br><br>"); // end of hyperlink with two carriage returns
}
}
If I understand your problem correctly, this code might help:
void CreateWebPages()
{
int y; // Start of Creating Webpages, one page for each song
for (y = 0; y < i; y++) {
client.print("<a name='");
client.print(y);
client.print("' style='text-decoration: none' href='"); // create hyperlink
client.print(y); // subpage to 192.168.1.100
client.print("#");
client.print(y);
client.print("'>");
client.print(titlesbuffer[y]); // names of songs sent to client
client.print("</a><br><br>"); // end of hyperlink with two carriage returns
}
}