modify downloaded html, but exclude normal document files...

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

modify downloaded html, but exclude normal document files...
 
grchen168




Posts: 38
Joined: 2014-09-03
Thanks for the reply.
"upgrade Internet Explorer" - currently not the way to go (for running on XP),
"change the content of the HTML document after it is completely loaded in IE" - can you help show sample code for that?
Posted 14 Jul, 2015 09:22:38 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Please look at the How to load custom CSS on every web page example.
To change the HTML document you can use the MSHTML object model. It can be done in the DocumentComplete2 event handler.
Posted 14 Jul, 2015 11:10:52 Top
grchen168




Posts: 38
Joined: 2014-09-03
Thanks for the info.
Question: the so-called "change the html in DocumentComplete2 event handler" also apply to inject (java)script?
Posted 14 Jul, 2015 18:21:22 Top
Sergey Grischenko


Add-in Express team


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

Yes, you can change HTML, CSS and to inject the javascript code in the DocumentComplete2 event handler.
E.g.


private bool IsJQueryInstalled()
        {
            try
            {
                if (HTMLDocument != null)
                {
                    object scriptEngine = HTMLDocument.Script;
                    if (scriptEngine != null)
                    {
                        // If jQuery is loaded, the 'jQuery' field is declared in JavaScript.
                        object jQueryRef = scriptEngine.GetType().InvokeMember(
                            "jQuery", System.Reflection.BindingFlags.GetProperty, null, scriptEngine, null);
                        return (jQueryRef != null);
                    }
                }
            }
            catch (Exception)
            {
            }

            return false;
        }

        private void IEModule_DocumentComplete2(object pDisp, string url, bool rootDocLoaded)
        {
            if (rootDocLoaded && (this.HTMLDocument != null))
            {

                if (!IsJQueryInstalled())
                {
                    string jQuerySource = BWGStickyPopupResources.jquery;
                    mshtml.IHTMLScriptElement scriptObject =
                        (mshtml.IHTMLScriptElement)HTMLDocument.createElement("script");
                    scriptObject.type = @"text/javascript";
                    scriptObject.text = "
" + jQuerySource + "
";
                    ((mshtml.HTMLBody)HTMLDocument.body).appendChild((mshtml.IHTMLDOMNode)scriptObject);
                }
         }
Posted 15 Jul, 2015 05:01:59 Top
grchen168




Posts: 38
Joined: 2014-09-03
Just would like to know when will be the fix available?
Is there any time table for it?
And, now, is it possible to request just a hot foix of it?
Posted 03 Aug, 2015 04:37:40 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hello,

I believe will we have answers tomorrow or the day after tomorrow. Will let you know.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Aug, 2015 06:53:15 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hello,

I am working on this issue now. I will let you know about results as soon as possible.
Posted 04 Aug, 2015 05:08:34 Top
grchen168




Posts: 38
Joined: 2014-09-03
Thanks.
And hope to get it to apply to my project in order to finally resolve the issue asap.
Posted 04 Aug, 2015 05:13:36 Top
Sergey Grischenko


Add-in Express team


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

I have just sent you an email. Please check your inbox.
Posted 04 Aug, 2015 10:54:40 Top