Need up to 30 seconds to load.
hi everyone so this early we'll learn
how you can redirect a user to another
page on your website or to a third party
website using HTML as well as using
javascript so let's get started let's
add some basic structure here and create
one h1 element this will be a counter
[Applause]
that's kept files in this clip dot yes
let's align this counter in the center
so make use of style attribute
text-align:center let's get one more
file you simply copy this and that point
will be hello dot HTML based it here
remove this part and here you make it
hello world so basically you want to
redirect user from this page to this
page so just close it now we have to
update this counter so in the script
file we'll make use of set interval
function
and do one thing you select this h1
element and we'll call it and let's make
variable here let's make it count and
initial state will be 1 for this and
we'll run this function of the each
second so you better put thousand here
to create the counter you make use of
counter taught in a text value will be
count you will also create the count
here we are done here with a JavaScript
part just save it and go to the HTML
file first we'll see the HTML approach
so just copy this paste it here replace
this with fresh okay and in the content
what five so basically after five
seconds you want to redirect to hello
dot HTML put a semicolon here and we
need to provide the path like this you
are in equal slash hello dot HTML now
just save it on this file in the browser
you can see after five seconds it will
redirect great in case you want to
redirect to some third-party website for
example google.com just copy this and
here what this URL okay save it now open
this file again you will see the counter
one two three four five it will redirect
to Google now let's try with the
JavaScript approach just comment on this
part
the script file if count is greater than
five you want to redirect
function will be location dot replace
and you provide the path here that will
be a lot of HTML now your sealed it open
this file in the browser
I think it should be HTML not the HML
disclose it and correct it here take it
HTML stay wit open this file again so
it's looking absolutely fine let's try
with google.com closer was this also
copy it and just paste it here save it
open this one in the browser so you can
see it's also working depending upon
your need you can go with any of these
two approaches you can go with this HTML
approach or you can make use of this
JavaScript function which is location
dot replace I hope you got the point how
directly works so the next video I wanna
stay