有人知道使用?protocol relative URLs?是否有問題嗎?用于圖像源以防止混合內(nèi)容安全警告。
例如鏈接一張圖片:
<img src="http://domain.com/img.jpg" />
代替:
<img src="http://domain.com/img.jpg" />
or
<img src="https//domain.com/img.jpg" />
在我的測試中,我沒有看到任何跡象表明這是錯誤的,但我不確定它是否存在會產(chǎn)生問題的邊緣情況。
編輯?我看到它在使用 PHP 的?getimagesize?時拋出錯誤功能。
請您參考如下方法:
在使用協(xié)議(protocol)相對 URL 時發(fā)現(xiàn)了一個有趣的問題:
ou have to be careful to only use this syntax in pages destined for browsers. If you put it in an email, there will be no base page URL to use in resolving the relative URL. In Outlook at least, this URL will be interpreted as a Windows network file, not what you intended.
來自?here
基本上,只要請求是由瀏覽器而不是外部電子郵件客戶端發(fā)出的,就沒有正當(dāng)理由說明這不應(yīng)該起作用。
更多信息來自?here?:
A relative URL without a scheme (http: or https:) is valid, per RTF 3986: Section 4.2. If a client chokes on it, then it's the client's fault because they're not complying with the URI syntax specified in the RFC.文章來源:http://www.zghlxwxcb.cn/news/detail-743137.html
Your example is valid and should work. I've used that relative URL method myself on heavily trafficked sites and have had zero complaints. Also, we test our sites in Firefox, Safari, IE6, IE7 and Opera. These browsers all understand that URL format文章來源地址http://www.zghlxwxcb.cn/news/detail-743137.html
到了這里,關(guān)于html通過使用圖像源的協(xié)議(protocol)相對 URL 來防止安全/不安全錯誤的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!