Render custom content

Add-in Express™ Support Service
That's what is more important than anything else

Render custom content
 
David Glowacki




Posts: 6
Joined: 2013-10-11
Hello,

I'd like to stop navigation on certain URLs, and render alternate content directly. For example:


        private void IEToolbarModule_BeforeNavigate2(ADXIEBeforeNavigate2EventArgs e) {
            if (!e.Url.ToString().Contains("yahoo.com")) {
                e.Cancel = true;
                this.HTMLDocument.write("<html>Site is blocked</html>");
            }
        }


However, this does not work, as no HTMLDocument has yet been rendered. Without navigating to another page, how do I accomplish this?

Thanks for any help.

Dave
Posted 11 Oct, 2013 00:21:31 Top
Andrei Smolin


Add-in Express team


Posts: 14137
Joined: 2006-05-11
Hello Dave,

Please have a look at ADXIEToolbarModule.HTMLDocumentText property.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 11 Oct, 2013 09:53:58 Top
David Glowacki




Posts: 6
Joined: 2013-10-11
Hi Andrei,

Thanks for your quick reply!

I attempted to use HTMLDocumentText; however, it resulted in a new blank tab being created when navigating:


        private void IEToolbarModule_BeforeNavigate2(ADXIEBeforeNavigate2EventArgs e) {
            e.Cancel = true;
            HTMLDocumentText = "dave was here";
        }


Should I be setting this text at a different point in the event lifecycle?

Dave
Posted 11 Oct, 2013 11:44:07 Top
David Glowacki




Posts: 6
Joined: 2013-10-11
Just to followup. It appears that the IPersistStreamInit interface permits this type of functionality, through the use of its Load() method. However, I was not able to access this method through IEToolbarModule.

http://msdn.microsoft.com/en-us/library/aa752047(v=vs.85).aspx


Any help is appreciated.
Posted 11 Oct, 2013 13:54:13 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi David,

Add-in Express uses the IPersistStreamInit interface to load HTML. However I found a bug in the code. It opens a new tab instead of loading HTML. I will send you a hotfix by email tomorrow. Do you use the latest version of Add-in Express?
Posted 14 Oct, 2013 11:41:45 Top
David Glowacki




Posts: 6
Joined: 2013-10-11
Hi Sergey,

Thanks for the response. Yes, I am using the latest version.

Dave
Posted 14 Oct, 2013 12:03:36 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi David,

I have just sent you the hotfix.
Posted 15 Oct, 2013 05:31:25 Top