0
As I get through JS, if my url is the index?
I have a code like this:
window.onload = function () {
url = window.location.href;
if (url.match("/dashboard")) {
[...]
}
}
that checks if it is in the Dashboard url. But how do I check if it is in the index? Since there is no /index
in the url, it is simply https://localhost:8080
?
I can’t do it like this:
if (url == "https://localhost:8080/") {
[...]
}
Because in the future this url will certainly be another one, and I will need to change the code (which I don’t want).
What is the value of
url
when you access the index?– Woss
@Andersoncarloswoss the value is
https://localhost:8080/
– edro