Hi James
Let me start by saying that as far as my original question(s) goes, I have got the answer, you have given me a working solution and M3 even posted another option. For that I am thankful to both of you. I like having more than one option to work with, and thanks to you guys now I do.
I believe I have missunderstood you, when earlier you asked “That works in the case you posted, but what about your other domains? Does it work for them, too?”
Before you asked that question I did try with all my domains and was working just fine, as I was expecting.
After reading your question, because of my misunderstanding of it, I went back and tried with the No-IP address, which includes the sub-domain.
I thought you meant to say that I should try with that No-IP address as well. My mistake was making assumptions about your question, but that gave me the idea to see if it works with sub-domains.
When I saw that was not working with sub-domains I reported back on it.
With my limited knowledge of coding I was looking at your script and the part
heading.textContent = window.location.pathname.toString().replace(/\//g, '');
gave the feeling that is parsing the url and it selects to display the top level domain only, ignoring everything outside of it (left an right), therefore working the way I asked for in the first place. This bit of code, in your post:
(/\//g, '')
is a mystery to me, but I think is what skips frames… maybe you can explain to me everything within the brackets, because I’m just curious, if you don’t mind of course.
The misunderstanding made me think that working with a domain and a sub-domain at the same time would also be a good idea. I do use the No-IP subdomain as well, but only to display some basic page, if someone lands on it by mistake/error. So I might as well put a placeholder page there that would show the domain/subdomain name on the page, same as on those other websites / domain names that I would be working on.
Is just that one idea leads to another, that is why I tried to see if your script works with the No-IP subdomain, or any other sub-domain for that matter, beside top level domains (example.com)
.
My original intent was to get a solution for any domain name in the form of “example.com
” and that was accomplished.
I hope I am not creating more confusion with my post, I just try to explain myself.
The bottom line: I do have the answer that I came here for.
I don’t mean to make things more complicated
Thank you very much James! I apreciate the time you have taken with this.
I appreciate M3’s suggestion as well, thank you very much!