Click here to Skip to main content
13,798,289 members
Click here to Skip to main content
Add your own
alternative version


12 bookmarked
Posted 5 Oct 2006
Licenced CPOL

How To Embed a Web Page in an InfoPath Form

, 5 Oct 2006
Rate this:
Please Sign up or sign in to vote.
How to embed a Web Page in an InfoPath Form


This document will give you an in-depth idea on how to embed a Web page within an InfoPath form. The Web page can be invoked with different URLs on click of a button.

The proposed solution below will help us avoid using Activex controls to act as custom controls within an InfoPath form. This will also avoid the problems of having a webBrowser control within an Internet browser page (see this article).

It is nearly impossible to add an iframe to the Xdocument.DOM of InfoPath.

Sample Scenario

An application form has to get details from a given URL in the InfoPath page. The user will click on the URL and the Web page will be populated within the InfoPath form, so that the user doesn't have to navigate out or switch to a different browser window.


A new TaskPane will be created and associated with the InfoPath form. This TaskPane by default will take a simple user created HTML page. On click of the button to the right of the given URL, TaskPane will be navigated to that specific URL. This is done by invoking an onclick event which navigates the TaskPane to the given URL.

Step By Step Walk-through

  1. Open Notepad and paste the following:

            Click on the Go button against the URL to open the web page
  2. Save and close the Notepad file as myTaskPane.HTML
  3. Open a new form in the Design Mode in InfoPath
  4. Go to Menu/Tools/Form options/Advanced
  5. Check “Enable Custom Task Pane”
  6. Type Task Pane name as WebPagePane
  7. Click on the Resource Files and add myTaskPane.HTML from its location
  8. Select Task Pane location as myTaskPane.HTML from the Form Option window
  9. Click Ok to close the Form Options window
  10. Add the textbox named URL to the form
  11. Add a button on the right of the URL textbox with a name/ID btnGo; label the button as GO
  12. Double-click on the GO button
  13. Click “Edit Form Code” button
  14. A script editor will be opened; paste the below code in the editor, save and close.

    function btnGo::OnClick(eventObj) 
        var objTaskPane; 
        var objXMLNode; 
        objXMLNode = XDocument.DOM.selectSingleNode("/mySample/URL"); 
        if (objXMLNode.text != "" && objXMLNode.text != null) 
            // Set a reference to the custom task pane. 
            objTaskPane = XDocument.View.Window.TaskPanes(0);
  15. Click on the Preview Form, type a URL and click GO... works!!
  16. Close the preview and save the form.

Note: If you would like to publish this form to public, you need to remove the security restrictions.

  • Go to Menu/Tool/Forms Options/Security
  • Uncheck “automatically determine security..”
  • Check Full Trust option
  • Check ‘Sign this form” and create or use a certificate

Install this certificate in the client computer where you use this form.


This is a simple solution for having a Web page within an infoPath form. Task Pane can be moved to any corner of the infopath window as per user’s convenience. Security levels of the forms have to be decided as per the requirements.


For any further information or any queries, reach out to me at

My blog:


  • 5th October, 2006: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
Canada Canada
Firoz Mohammed (Firoz`Ozman) |
MCSD.Net, MCTS (BizTalk 2004 & 2006)
Avanade Inc: |
Toronto, Canada |

You may also be interested in...

Comments and Discussions

QuestionHow to embed an infopath in a webpage Pin
manasa162329-Nov-07 4:33
membermanasa162329-Nov-07 4:33 
GeneralDownload? [modified] Pin
Oskar Austegard9-Oct-06 11:53
memberOskar Austegard9-Oct-06 11:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web05 | 2.8.181207.3 | Last Updated 5 Oct 2006
Article Copyright 2006 by FirozOzman
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid