Can we make a password protected webpage? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can we make a password protected webpage?

I mean html code not Php..

19th Mar 2017, 2:15 PM
EM Farih
EM Farih - avatar
9 Answers
+ 4
I know that. I wrote it for @EM Farih
19th Mar 2017, 2:31 PM
Max_N
Max_N - avatar
+ 4
There is web server in front of your HTML / PHP code. Apache, nginx or similar. It is the responsibility of this web server to set password protection for an URL.
19th Mar 2017, 3:50 PM
Tamás Barta
Tamás Barta - avatar
+ 3
But everyone can see the source code.
19th Mar 2017, 2:28 PM
Max_N
Max_N - avatar
+ 3
@Vishal Prajapati no problem :)
19th Mar 2017, 2:33 PM
Max_N
Max_N - avatar
+ 2
Yes by using JavaScript; <SCRIPT> var pass = prompt("Enter Password",""); if(pass == "YourPassWord"){ document.write("<H1>YOU HAVE ENTERED RIGHT PASSWORD</H1><H2>CONTENT GOES HERE</H2>"); }else{ document.write("<H1>WRONG PASSWORD</H1><H2>REFRESH TO TRY AGAIN"); } </SCRIPT>
19th Mar 2017, 2:20 PM
Vishal Prajapati
+ 2
@Max_N HTML is client side language so, they can ovuisely able to see source code contains may be password there is no control over that that's why Server Side Scripting is Introduced. There is no solution for that you need to use Server side scripting like PHP.
19th Mar 2017, 2:30 PM
Vishal Prajapati
+ 2
@Max_N sorry for that. :-(
19th Mar 2017, 2:32 PM
Vishal Prajapati
+ 2
ty
25th Mar 2017, 6:35 AM
Umut Dalkılıç
Umut Dalkılıç - avatar
0
Oh yeah. I know that. Ngono ae gaiso
20th Mar 2017, 4:35 AM
Furqon Afif
Furqon Afif - avatar