2013-01-08 130 views
1

我:mozRequestFullScreen();不工作。爲什麼?

function doit() 
{ 
    document.getElementById('id1').mozRequestFullScreen(); 
} 

但它不工作。雖然它爲this site

jsFiddle here

爲什麼? (我正在使用FireFox。)

+0

什麼是調用的結果?嘗試'var result = document.getElementById('id1')。mozRequestFullScreen();'並設置一個斷點來檢查結果。 –

+0

@PlanB'undefined'。 – ispiro

回答

4

JSFiddle結果顯示在iframe中。除非這個框架明確允許加入全屏所mozallowfullscreen屬性將靜默失敗:

https://developer.mozilla.org/en-US/docs/HTML/Element/iframe#attr-mozallowfullscreen

+0

我在一個web項目(ASP.Net)中也嘗試了這種方式,它也不起作用。那裏沒有iframe。 – ispiro

+0

無論你的問題是什麼,它當然與ASP無關,因爲這是服務器端語言。 – eikes

+1

問題在於缺乏用戶交互。請參閱:http://stackoverflow.com/a/14244427/939213。 – ispiro