我的網站佈局是這樣的:防止惡意Flash廣告
{主頁(iframe中包含Flash廣告)}
有時惡意Flash廣告會加載到框架中,並將用戶重定向到他們選擇的網站。我想他們在actionscript中使用getURL()函數。
由於我擁有頁面以及框架內的頁面,因此可以編輯html,因此無論如何阻止Flash廣告通過iframe發送請求以更改頂部位置。
任何幫助,將不勝感激。 謝謝。
我的網站佈局是這樣的:防止惡意Flash廣告
{主頁(iframe中包含Flash廣告)}
有時惡意Flash廣告會加載到框架中,並將用戶重定向到他們選擇的網站。我想他們在actionscript中使用getURL()函數。
由於我擁有頁面以及框架內的頁面,因此可以編輯html,因此無論如何阻止Flash廣告通過iframe發送請求以更改頂部位置。
任何幫助,將不勝感激。 謝謝。
HTML5來拯救!
只需添加到您的iframe:
sandbox="allow-scripts"
這個iframe的沙箱功能可以防止任何在iframe重定向從頁面或執行任何頂部框架導航。
你想要的值是:
allow-scripts - Allows script execution
其他三米沙盒你不想要的選項有:
allow-same-origin - Allows the iframe content to be treated as being from the same origin as the containing document
allow-forms - Allows form submission
allow-top-navigation - Allows the iframe content to navigate (load) content from the containing document
完全 '沙盒' 的iframe:
sandbox=""
功能齊全的iframe:
sandbox="allow-scripts allow-forms allow-same-origin allow-top-navigation"
(或簡單地省略該屬性)
這可行,但重要的是要注意,它只支持Chrome和Safari(現在)。 http://www.w3schools.com/html5/att_iframe_sandbox.asp – Chris 2012-06-29 03:01:53
對於嵌入/對象標籤,類似'allowcriptaccess =「never」'。 – kirilloid 2012-04-17 20:06:06
如果我將它添加到iframe或embed標籤,我認爲這會阻止Flash廣告運行,因爲大多數廣告公司都使用JavaScript來調用Flash廣告。 – User 2012-04-17 21:44:25
那麼總結一下,如果不阻止所有廣告的運作,沒有什麼辦法可以做到這一點? – User 2012-05-03 13:38:16