Ok, y a un truc qui marche, mais le résultat est inatendu.
Mais avant, je vais donner tout le code pour partir sur des bonnes bases
CodeBehind :
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Me.InitScript()
End Sub
Private Sub InitScript()
Dim script As String = String.Format(" function mafonc(){{{0}; }}", ClientScript.GetPostBackEventReference(LB1, ""))
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "iframeScript", script, True)
End Sub
Sub LB1_Click(ByVal sender As Object, ByVal e As EventArgs)
'Ici ton code après récupération du clic
Logage("j'ai un click")
End Sub |
Code HTML :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<ajax:ScriptManager ID="sm" runat="server"></ajax:ScriptManager>
<div>
Compteur
<asp:LinkButton ID="LB1" runat="server" Style="display: none;" OnClick="LB1_Click" ></asp:LinkButton>
<iframe id="maframe" name="nmaframe" src="http://www.google.fr" width="100%" height="600" ></iframe>
</div>
</form>
</body>
</html> |
Dans cette version de code, il ne se passe rien.
Mais si je rajoute un onload sur la Iframe tel que ça :
<iframe id="maframe" name="nmaframe" src="http://www.google.fr" width="100%" height="600" onload="mafonc();" ></iframe>
Il part en boucle infinie et j'ai bien un logage qui se fait dans mon fichier texte de test
Donc, c'est que ça fonctionne.
Maintenant, faudrait le moyen qu'il ne boucle pas et là, je creuse mais je trouve pas.
Est il possible, du même coup, de récupérer l'URL complète qui nourri la Iframe, à chaque clic dedans ?
Partager