發表文章

目前顯示的是 10月, 2023的文章

如何避免使用者使用上一頁回來

解1. 因為不想讓使用者按上一頁,回來看到本頁,所以判斷當使用者按上一頁進來時,回到上一頁。 window.addEventListener('pageshow', function (event) {     if(event.persisted || window.performance && window.performance.navigation.type == 2){         window.history.go(-1);     } },false); window.performance.navigation.type 屬性包含了頁面導航的類型。該屬性可以用來判斷頁面是如何被訪問的。 屬性值 0:TYPE_NAVIGATE:使用者通過常規導航方式訪問頁面,比如點擊一個連結,或者一般的 get 方式。 1:TYPE_RELOAD:使用者通過刷新,包括 JavaScript 調用刷新接口等方式訪問頁面。 2:TYPE_BACK_FORWARD:使用者通過後退按鈕訪問本頁面。   參考來源: https://blog.csdn.net/weixin_41190571/article/details/87970446 解2. 使用window.replace方法,讓頁面不產生紀錄,不讓使用者可以回到上一頁。

使用 ssh terminal連線cloudflare tunnels伺服器

圖片
在完成cloudflare tunnel SSH設定後,想要用terminal對Server進行連線,如果還沒完成設定請參考: https://lanwp.org/15-how-to-use-cloudflaretunnel-build-webbase-sshterminal/ 發現怎麼樣都無法透過SSH連線到自己的伺服器 經過爬文發現需要透過cloudflare的驗證才能連線上,參考來源: https://community.cloudflare.com/t/about-connect-as-a-user-ssh-client-windows-10/524994 1.下載cloudflare的程式 https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/ ,放在路徑"C:\Users\{user}\.ssh\cloudflared-windows-amd64.exe",linux的話路徑為/usr/local/bin/cloudflared 2.編輯檔案"C:\Users\{user}\.ssh\config" Host example.com     HostName example.com     ProxyCommand C:\Users\{user}\.ssh\cloudflared-windows-amd64.exe access ssh --hostname %h     User user 完成後就可以透過terminal完成連線!