Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to disable rightclick of Web Browser Control
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00595476
Message ID:
00595711
Vues:
39
>>Hi Dragan.
>>
>>Thanks for your attention.
>>
>>I´ve found some code such that of bravenet... unfortunately, those scripts shows a popup (alert window...)... I really would like to simply ignore rightclick, without shows anything to the user... as office xp´s outlook does.
>>
>>anyway, thanks a lot.
>
>You just have to strip out the "alert" part of the script....


Unfortunatly the alert must stay on the script :(
I have tested a lot of different ways to disable the rightclick
but no one have worked.

But, if you want to dynamically add the script to the pages, you can put this code in the DocumentComplete() method of the control.

Scripts are not allowed on UT, so change the S*RIPT for SCRIPT and
B*DY to BODY in your code.
*keep all the contain of the page
sData = this.document.documentElement.innerHTML
*find the final ">" of the body declaration
nPos=AT('<B*DY ',UPPER(sData))+5
IF nPos>5
	nPos=nPos+AT('>',SUBSTR(sData,nPos+1))+1
ENDIF
*--if the body was found
IF nPos>6
	*create a document to insert the script
	oNewDoc = this.document.open('text/html', 'replace')
	*change the contain
	sNewData=SUBSTR(sData,1,nPos)+CHR(10)+;
	[<S*RIPT LANGUAGE='JScript'>]+chr(10)+;
	[function noway() { ]+chr(10)+;
	[if (event.button == 2) { ]+chr(10)+;
	[alert('Right mouse disabled');]+chr(10)+;
	[return false; ]+chr(10)+;
	[} ]+chr(10)+;
	[} ]+chr(10)+;
	[document.body.onmousedown=noway;]+CHR(10)+;
	[</S*RIPT>]+CHR(10)+;
	SUBSTR(sData,nPos+1)
	*write the new doc
	oNewDoc.write(sNewData)
	*finalize
	oNewDoc.close()
ENDIF
HTH somebody :-)
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform