
Hình ảnh minh họa

Hình ảnh khi bạn nhập đúng password

1. Đầu tiên đăng nhập tài khoản Blogger
2. Vào thiết kế chọn chỉnh sửa HTML
3. Chèn code bên dưới vào sau thẻ <head>
<script language='JavaScript'>
var password;
var pass1="hienthieugia";
password=prompt('Please enter your password to view this page!','');
if (password==pass1)
alert('Password Correct! Click OK to enter!');
else
{
window.location="http://hienthieugia.blogspot.com/";
}
</script>
Bạn hãy thay dòng màu đỏ đậm thành password mà bạn muốn đặt cho trang của bạn và dòng màu xanh đậm là địa chỉ được trả về khi bạn đánh sai password hay nhấn cancel. Bạn hãy thay nó thành địa chỉ trên blog của bạn.
4. Save template lại là xong.
☼ Mở rộng thêm thủ thuật
Ở trên thủ thuật sẽ có tác dụng cho toàn bộ các trang trên blog của bạn, tức là khi vào trang chủ hay các trang bài viết bạn cũng phải nhập password mới có thể xem được. Bây giờ chúng ta sẽ cho phép thủ thuật này có tác dụng ở các trang nhất định. Bạn chỉ việc thay code ở bước 3 thành các code bên dưới.
A. Đặt password cho bài viết nhất định <và nó sẽ không rời khỏi bài viết cho đến khi bạn nhập đúng pass>
<b:if cond='data:blog.url == "http://hienthieugia.blogspot.com/2012/07/tao-mat-khau-password-cho-bai-viet-tren.html"'>
<script language='JavaScript'>
var password;
var pass1="hienthieugia";
password=prompt('Please enter your password to view this page!','');
if (password==pass1)
alert(';Password Correct! Click OK to enter!');
else
{
window.location="http://hienthieugia.blogspot.com/2012/07/tao-mat-khau-password-cho-bai-viet-tren.html";
}
</script>
</b:if>
<script language='JavaScript'>
var password;
var pass1="hienthieugia";
password=prompt('Please enter your password to view this page!','');
if (password==pass1)
alert(';Password Correct! Click OK to enter!');
else
{
window.location="http://hienthieugia.blogspot.com/2012/07/tao-mat-khau-password-cho-bai-viet-tren.html";
}
</script>
</b:if>
Bạn thay dòng màu đỏ thành link bài viết của bạn.
B. Đặt password cho các bài viết trên blog
<b:if cond='data:blog.pageType == "item"'>
<script language='JavaScript'>
var password;
var pass1="hienthieugia";
password=prompt('Please enter your password to view this page!','');
if (password==pass1)
alert('Password Correct! Click OK to enter!');
else
{
window.location=" http://hienthieugia.blogspot.com/2012/07/tao-mat-khau-password-cho-bai-viet-tren.html ";
}
</script>
</b:if>
<script language='JavaScript'>
var password;
var pass1="hienthieugia";
password=prompt('Please enter your password to view this page!','');
if (password==pass1)
alert('Password Correct! Click OK to enter!');
else
{
window.location=" http://hienthieugia.blogspot.com/2012/07/tao-mat-khau-password-cho-bai-viet-tren.html ";
}
</script>
</b:if>
Ngoài ra, bạn cũng có thể thiết lập nhiều password cho trang đó, chỉ cần nhập đúng 1 trong các password được thiết lập sẵn trước đó bạn sẽ vào được trang đó. Và code có dạng như bên dưới.
<script language='JavaScript'>
var password;
var pass1="pass1";
var pass2="pass2";
password=prompt('Please enter your password to view this page!','');
if (password==pass1 || password==pass2)
alert('Password Correct! Click OK to enter!');
else
{
window.location="http://hienthieugia.blogspot.com/";
}
</script>
Bạn thay các dòng màu đỏ thành các password mà bạn muốn đặt cho trang nhất định.
Hiện tại ở một blog của mình có dùng code pass như sau:
<b:if cond='data:blog.url == "http://9d-class.blogspot.com/search/label/HSG%20V%E1%BA%ADt%20L%C3%BD"'>
<script language='JavaScript'>
var password;
var pass1="***********";
password=prompt('Mời bạn nhập pass để xem mục (Phân biệt cả chữ hoa và chữ thường)! (Mật khẩu giống như bên diễn đàn Giáo Viên Trung Học) *Lưu ý: Khung nhập pass có 1 khoảng trắng ở đầu bạn hãy lưu ý đến nó!!!',' ');
if (password==pass1)
alert('Pass đúng ! Mời bạn click OK để vào xem các bài tập ở đây !');
else
{
alert('Pass sai ! Chúng tôi sẽ đưa bạn về trang chủ');
window.location="http://9d-class.blogspot.com";
}
</script>
</b:if>
Đối với các bạn dùng giao diện mobile thì các bạn thêm
<b:if cond="data:blog.isMobile">
trước code pass ở trên và</b:if>
Sau code pass ở trên rồi chèn vào mẫuChúc bạn thành công
Tham khảo từ: traidatmui.com
Related Post :
Subscribe to:
Post Comments (Atom)
Mình làm pass word theo đoạn code của bạn. Khi truy cập bằng laptop thì ok, nhưng khi truy cập bằng điện thoại android thì vào thẳng luôn pass không có tác dụng chặn nữa.
ReplyDeleteBạn còn đoàn code nào để chặn mọi thiết bị không.
Cảm ơn bạn nhiều
Mình đã bổ sung bài viết ở cuối bạn có thể xem lại
Deletecó cách nào cho pass ẩn khi mình điền pass ko nhỉ
ReplyDeleteanh cho em hỏi cách tạo cái hình tròn facebook trên đầu blog
ReplyDeleteanh cho em hỏi cách tạo cái hình tròn facebook trên đầu blog
ReplyDeleteAnh ơi, hình như code này không tương thích với Android thì phải, em đã cóp đoạn code password (pw), code Mobile, sửa lại url riêng cho 1 bài viết thế nhưng vừa truy cập blog trên Android liền thấy khung pw hiện ra (cứ như thể đó là pw của blog) mặc dù em không hề bấm vô bài đã cài pw.
ReplyDelete