2017-07-29 12 views
1

私は常に上に、ボーダレスを作るしようとしているが、YouTubeのプレイヤーは、私が設定ほとんどすべてを持って、ここに私のコードです:が常に上に、デスクトップのYouTubeプレーヤー

Dim html_aux As String = InputBox("Inserte URL YouTube") 
    Dim s As String() = html_aux.Split("=") 
    Dim htmlContent As String = "<html><body><iframe width='480'; height='271'; src='https://www.youtube.com/embed/" & s(1) & "'; frameborder='0';></iframe></body></html>" 
    Dim archivo As New System.IO.StreamWriter(".\Index.html", False) 
    If System.IO.File.Exists(".\Index.html") Then 
     archivo.WriteLine(htmlContent) 
     archivo.Close() 
    Else 
     MkDir(".\Index.html") 
     archivo.WriteLine(htmlContent) 
     archivo.Close() 
    End If 
    Navegador.Navigate("file:///" & IO.Path.GetFullPath(".\index.html")) 

問題が来るIアプリケーションを起動します。 WebBrowserコントロールから3つのエラーが発生します。

スクリプトエラー。

Error: Object doesn't support property or method 'create'.

私の推測では、これらのエラーは、youtube.com/embed/urlが保持している実際のHTMLコードをサポートしていないWebブラウザーから来ています。

WebBrowserでこれらの競合を処理する方法はありますか?私は試してみるべきですか?

答えて

1

私は、HTMLコードに以下のヘッダを追加しても問題が解決し、質問に対する答えを見つけることがありません:

<html> 
    <head> 
    <meta http-equiv='X-UA-Compatible' content='IE=edge' /> 
    ... headers code 
    </head> 
    <body> 
    ... body code 
    </body> 
</html> 

私はもはやスクリプトエラーを取得します。

全体コード:

Public Class Form1 

Private Sub URLToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles URLToolStripMenuItem.Click 

    Dim html_aux As String = InputBox("Inserte URL YouTube") 
    Dim s As String() = html_aux.Split("=") 
    Dim htmlContent As String = 
     "<html> 
     <head> 
     <meta http-equiv='X-UA-Compatible' content='IE=edge' /> 
     </head> 
     <body> 
     <!DOCTYPE html PUBLIC '-//WAPFORUM//DTD XHTML Mobile 1.2//EN' 'http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd'> 
     <iframe width='480'; height='271'; src='https://www.youtube.com/embed/" & s(1) & "'; frameborder='0';> 
     </iframe> 
     </body> 
     </html>" 
    Dim htmlFile As New System.IO.StreamWriter(".\Index.html", False) 
    If System.IO.File.Exists(".\index.html") Then 
     htmlFile.WriteLine(htmlContent) 
     htmlFile.Close() 
    Else 
     MkDir(".\index.html") 
     htmlFile.WriteLine(htmlContent) 
     htmlFile.Close() 
    End If 
    Navegador.Navigate("file:///" & IO.Path.GetFullPath(".\index.html")) 
End Sub 

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load 
    Me.TopMost = True 
End Sub 

End Class 
関連する問題