Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to disable scripts when using CXTHtmlView
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to disable scripts when using CXTHtmlView

 Post Reply Post Reply
Author
Message
fabien7474 View Drop Down
Newbie
Newbie


Joined: 09 December 2006
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote fabien7474 Quote  Post ReplyReply Direct Link To This Post Topic: How to disable scripts when using CXTHtmlView
    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.
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 09 December 2006 at 10:35am
Hi,
 
Check in msdn:
 
DISPID_AMBIENT_DLCONTROL and DLCTL_NO_SCRIPTS.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
fabien7474 View Drop Down
Newbie
Newbie


Joined: 09 December 2006
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote fabien7474 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
fabien7474 View Drop Down
Newbie
Newbie


Joined: 09 December 2006
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote fabien7474 Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.