IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB 6 et antérieur Discussion :

Probleme liens WebBrowser


Sujet :

VB 6 et antérieur

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    177
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 177
    Par défaut Probleme liens WebBrowser
    Bonjour a tous

    un Control WebBrowser IE6 sous VB6.
    Aucuns liens ne fonctionne s'ils sont local.
    Si j'indique un site Internet ça fonctionne..
    J'ai fait plusieurs tests sans succès et
    j'arrive au bout d'mes competences..

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    Form1.WebBrowser1.Document.writeln "<html>"
    Form1.WebBrowser1.Document.writeln "<body>"
     
    Form1.WebBrowser1.Document.writeln "<a href=c:\test.html>toto1</a></p>"
    Form1.WebBrowser1.Document.writeln "<a href=c:/test.html>toto2</a></p>"
    Form1.WebBrowser1.Document.writeln "<a href=file:///c:/test.html>toto3</a></p>"
     
    Form1.WebBrowser1.Document.writeln "<a href=" & Chr(34) & "c:/test.html" & Chr(34) & ">toto4</a></p>"
    Form1.WebBrowser1.Document.writeln "<a href=" & Chr(34) & "file:///c:/test.html" & Chr(34) & ">toto5</a></p>"
     
    Form1.WebBrowser1.Document.writeln "</body>"
    Form1.WebBrowser1.Document.writeln "</html>"

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    177
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 177
    Par défaut
    Si j'essai ceci, j'ai un message Javascript "Permission refusé"

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Form1.WebBrowser1.Document.writeln "<a href=" & Chr(34) & "javascript:document.location.replace(" & Chr(39) & "file:///c:/test.html" & Chr(39) & ")" & Chr(34) & ">toto</a>"
    Si à la place de "file:///c:/test.html" je mets "http://www.google.fr"
    ça marche.

    Si je mets le fichier "test.html" dans "c:\" et que je specifie "file:///test.html",
    ça marche.


  3. #3
    Rédacteur
    Avatar de DarkVader
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2002
    Messages
    2 131
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2002
    Messages : 2 131
    Par défaut
    Bonjour

    Je n'ai pas de problème particulier en pratiquant ainsi
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
     
    Private Sub Form_Activate()
        Form1.WebBrowser1.Navigate "about:blank"
    End Sub
     
    Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
        Dim hDoc As New HTMLDocument, content As String
     
        Select Case URL
            Case "about:blank"
                Set hDoc = Form1.WebBrowser1.Document
                URL = Chr(34) & "file:///E:\phpBB.jpg" & Chr(34)
                content = "<html><body><a href=" & URL & ">toto</a></body></html>"
     
                With hDoc
                    .body.innerHTML = content
                    'etc
                End With
        End Select
    End Sub

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    177
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 177
    Par défaut
    Merci pour ta reponse DarkVader

    j'ai essayé ton code en remplacant ton
    "file:///E:\phpBB.jpg"
    une fois par
    "file:///D:\test.jpg"
    , une autre fois par
    "file:///C:\test.html"
    , mais sans succès

    J'ai testé sur 2 pc, 1 avec IE6, l'autre avec IE8, pareil.

    Quand on click, rien ne se passe.
    Si je fais un click droit sur le lien, j'obtiens pourtant :
    "file:///C:/test.html"
    Par contre, si je mets
    "test.html"
    dans c:\ et que j'indique :
    "file:///test.html"
    ça marche

    Il y a un problème quand je spécifie une lettre de lecteur

Discussions similaires

  1. Probleme avec Webbrowser
    Par SegmentationFault dans le forum Delphi
    Réponses: 5
    Dernier message: 20/08/2006, 16h53
  2. probleme lien ODBC
    Par milielf dans le forum Access
    Réponses: 1
    Dernier message: 29/06/2006, 12h04
  3. [Configuration] probleme lien et variable
    Par yankey dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 2
    Dernier message: 23/03/2006, 23h31
  4. [HTML] problème lien
    Par miram dans le forum Balisage (X)HTML et validation W3C
    Réponses: 1
    Dernier message: 14/02/2006, 13h13
  5. [FLASH MX2004] Probleme liens boutons
    Par pierpo dans le forum Flash
    Réponses: 2
    Dernier message: 16/11/2005, 23h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo