20 Replies
Me nub in javascript , das why ;-;
You can use a setTimeout() function I guess
Lemme check
So…again, what are you trying to accomplish? Where do you want a dely? Why do you want the delay?
Maybe he wants a delay before the user going to the next page. Like to make a loading screen or show some message
Maybe, but we don't know yet. Which is my point :p
To be fair in the title Cosmic does say "...delay before redirecting to another page"
While redirecting to new page some time , my esp8266 shows no page found.. so just making sure if adding delay before redirecting would help
Adding a delay won't help if there's no page to redirect to
A point which I would like to point out, instead of using className you would like to use classList.add("name-of-the-class"), because className = … can overwrite the other classes iirc
But sometimes when i take that page directly , it loads.. When i go through the login html , it says no page found..
A few things:
1. You're using an invalid URL in your "redirect" (it needs to be a fully qualified URL)
1. You should be using
window.location.assign(URL)
https://developer.mozilla.org/en-US/docs/Web/API/Location/assign
Or you could use window.location.pathname
instead, I guess, as that changes only the pathname. But I believe you're supposed to use the methods instead of setting the location bits individuallyidk what it means 💀 , Im using html for first time just for a proj.
so , href and assign(URL) works the same way?
No, they're different. That's why I suggest you use
.assign()
instead
instead of window.location.href="/dashboard";
you should do window.location.assign("/dashboard");
. See if that worksAssign , adds a part to url or removes it??
The–MDN It's a way of changing the URL to a different one. You can either do a full URL (assign()
method of theLocation
interface causes the window to load and display the document at the URL specified. After the navigation occurs, the user can navigate back to the page that calledLocation.assign()
by pressing the "back" button.
https://discord.com/developers
) or a relative path (/developers
)like if it was,
http://test.local/ , applying href="/dashboard"
it will become http://test.local/dashboard
And assign will go back to url right? (shortening it , basically what i mean)
And assign will go back to url right? (shortening it , basically what i mean)
Yes
I was also looking for that thing.. thanks for the info , might be useful for future :)
So here , basically , ESP8266 chip checks for if there is any changes to url. when login is sucessfull . It will check is they added.. And execute the void mainpage() {}
I suck in explaining 💀