問題描述
我正在使用視頻嵌入代碼(類似于 youtube 的嵌入代碼),我想加密或散列一部分代碼(視頻的視頻 ID 或文件名).對我而言,查看頁面源代碼的用戶將無法查看這些項目,這一點很重要.有什么辦法可以這樣做嗎?有什么推薦嗎?
I am using an video embed code (Similar to youtube's embed code) and I would like to Encrypt or hash a part of the code (The Video id or filename of the video). It is important to me that a user that views the source code of the page wont be able to view those items. Is there a way I can do so? Any recommendation?
我想補充一點,我的網站正在使用 php.
I'd add that my site is using php.
例如,這是一個 youtube 嵌入代碼:
For example, here is an youtube embed code:
<object width="420" height="315"><param name="movie" value="http://www.youtube.com/v/fRgWBN8yt_E?hl=en_US&version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/fRgWBN8yt_E?hl=en_US&version=3" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>
假設我想更改部分:
value="http://www.youtube.com/v/fRgWBN8yt_E?hl=en_US&version=3">
進入:
value="sdfj8435437fjdfs8458543(Some Kind of hashing or encryption)">
謝謝,
尼米
推薦答案
那是完全不可能的.
無論您做什么,用戶都可以在檢查器或網絡選項卡中看到最終結果.
No matter what you do, the user can see the final result in the inspector or network tab.
相反,您可以在 URL 中放置一個一次性令牌,以便它只能使用一次.
Instead, you can place a single-use token in the URL so that it will only work once.
這篇關于在源代碼視圖中加密 html 代碼的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!