Print Page | Close Window

How to disable scripts when using CXTHtmlView

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=5734
Printed Date: 19 May 2025 at 1:59am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to disable scripts when using CXTHtmlView
Posted By: fabien7474
Subject: How to disable scripts when using CXTHtmlView
Date Posted: 09 December 2006 at 5:14am
Hi,

I am using the CXTHtmlView class in our MFC document/view application in order to display HTML pages in a WebBrowser style.

Nevertheless, we would like sometimes to disable scripts (for instance java-scripts) when rendering the HTML page (for security reasons).
I didn''t find any method/code that provides this functionnality.
Do you know if it is possible to do it using CXTHtmlView class. If not, what do you suggest in order to do it.

Thank you very very much,

Fabien.



Replies:
Posted By: Simon HB9DRV
Date Posted: 09 December 2006 at 5:40am
I would like to be able to disable Flash on various sites, would also like any pointers.

-------------
Simon HB9DRV


Posted By: Oleg
Date Posted: 09 December 2006 at 10:35am
Hi,
 
Check in msdn:
 
DISPID_AMBIENT_DLCONTROL and DLCTL_NO_SCRIPTS.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: fabien7474
Date Posted: 09 December 2006 at 1:25pm
Hi Oleg.

Thank you very much!!

Anyway, I have been searching for DISPID_AMBIENT_DLCONTROL and DLCTL_NO_SCRIPTS but I didn't find any relevant C++ code, using these properties.

Do you know how to use it?

Do I need to use PutProperty() from CHtmlView?

Do you have a very simple sample code?

Thank you soooo much for your help...

Fabien


Posted By: fabien7474
Date Posted: 09 December 2006 at 5:53pm
Okay Guys!!

I spent my day on it but I finally figure out how to do it:

BOOL CMyHtmlView::OnAmbientProperty(COleControlSite* pSite, DISPID dispid,    VARIANT* pvar)
{
    if (dispid == DISPID_AMBIENT_DLCONTROL) {
        pvar->vt = VT_I4;
        pvar->lVal = DLCTL_NO_SCRIPTS | DLCTL_NO_JAVA | DLCTL_NO_RUNACTIVEXCTLS | DLCTL_NO_DLACTIVEXCTLS;
        return true;
    }
    return HtmlView::OnAmbientProperty(pSite, dispid, pvar);
}

Thanks,

Fabien.



Posted By: Simon HB9DRV
Date Posted: 10 December 2006 at 3:36am
Originally posted by fabien7474 fabien7474 wrote:

Okay Guys!!

I spent my day on it but I finally figure out how to do it:

BOOL CMyHtmlView::OnAmbientProperty(COleControlSite* pSite, DISPID dispid,    VARIANT* pvar)
{
    if (dispid == DISPID_AMBIENT_DLCONTROL) {
        pvar->vt = VT_I4;
        pvar->lVal = DLCTL_NO_SCRIPTS | DLCTL_NO_JAVA | DLCTL_NO_RUNACTIVEXCTLS | DLCTL_NO_DLACTIVEXCTLS;
        return true;
    }
    return HtmlView::OnAmbientProperty(pSite, dispid, pvar);
}

Thanks,

Fabien.


Excellent - weel done lad!


-------------
Simon HB9DRV



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net