Jump to content

wrong hyperlink in webserver


pascal

Recommended Posts

Hi,

I have a table with all my IP adress of all my connected things.

I made a webpage, showing my table with all the IP adresses 

when clicking on a field in the table, I put the IPadress (ASCII) into a tag -> IP adres (reading the selected row of the datatable)

on the webpage a put a hyperlink "GO TO" with the adress of this hyperlink the value of tag IP adress

but when clicking on the hyperlink, he's calling another IP adress.....

I did an inspect of the webpage (clicking right mouse button 😁) and found something strange....

image.thumb.png.0054c5e4574b9445749640adeb3e6696.png

BUT I FOUND a solution ? -> the problem is the leading zero's of the IP adres in my tag....

when I remove the leading zero's, then I have a correct hyperlink (only tried one (172.20.25.40)

image.thumb.png.3dad5a46f9f73d26950fdee90ea34936.png

 

something to keep in mind...

Link to comment
Share on other sites

This is actually, not the Web Server or the PLC's fault. Here is just a simple example of a single hyperlink that reproduces the problem (No Web server or JavaScript are involved, just plain HTML).

You can see that it navigates to 172.20.25.33 instead of 172.20.25.41

41 in Oct base (8 base, digits 0-7) is exactly 33, and if you put .010 instead of 041, it will go to 8 (since 10 in oct base is 8).

I'm guessing that when padding a zero before  the number, chrome (and probably all the browsers) is parsing it in Oct base.

 

You can read about it here as well:

https://superuser.com/questions/857603/are-ip-addresses-with-and-without-leading-zeroes-the-same

test.html

  • Upvote 1
Link to comment
Share on other sites

  • MVP 2023
On 11/10/2023 at 9:27 AM, Flex727 said:

in Ping, when using a leading zero it interprets the number as hex rather than decimal

 

On 11/12/2023 at 2:59 AM, Saragani said:

when padding a zero before  the number, chrome (and probably all the browsers) is parsing it in Oct base

Ah! Octal, not hex.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...