XMLHTTPRequest, is it possible?

Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default XMLHTTPRequest, is it possible?

    For now I simply want to know if its possible.

    I want to write an extension, that when a user clicks on a button it requests
    a web page from their domain, and copys the contents into their currently
    opened document.

    digitalpacman Guest

  2. Similar Questions and Discussions

    1. XML from CFC for XMLHttpRequest
      Hi all: Let me prefix my question with the statment that I have searched the forums and found the answers given there to not be the solution to...
    2. CustomValidator and XMLHTTPRequest
      yes. "Anatoly" <anatolyr@gilat.com> wrote in message news:#feBwBqVDHA.2248@TK2MSFTNGP10.phx.gbl...
  3. #2

    Default Re: XMLHTTPRequest, is it possible?

    I'm guessing here because I don't have my references with me, but you should be
    able to do that. You should probably use a command menu item for this.

    Create the menu command by first creating an html page. Between the document's
    <title></title> tags, enter the name of the command you want to appear in the
    "Commands" menu (i.e. "Get web page contents"). Save the page to your
    "Configurations/commands" folder using the same name. Create a ".js" file with
    the same name as the html file, save it to the same folder and link it to the
    html page.

    In the ".js" file be sure to write the "canAcceptCommand()" function to return
    a value of true if there is an active document (DOM). Like this...

    function canAcceptCommand() {
    (dw.getDocumentDOM) ? return true : return false;
    }

    I'm not sure if that's entirely correct, so double-check that.

    Then in the document's <body> tag, add the "onload" event to call the function
    to perform the task. Ex:

    <body onload="getURL()">

    Then in your script file, write the function to read or open the web page. Of
    course, I think this will open it as a new document and not add it to the
    current one. You may need to perform some type of "setSelection()" or
    "selectAll()" to replace the contents of the current document if one is open.
    It may be easier to open it as a new file rather than pasting it inside an
    opened one.

    function getURL() {
    var theDOM = dw.getDocumentDOM('http://www.thepage.com');
    var strFile = DWfile.read(theDOM);
    DWfile.open(strFile);
    }

    After you save the file in the "commands" folder, restart Dreamweaver and you
    should see a new selection at the bottom of the "Commands" drop-down menu. If
    the code is correct, then selecting the menu item should open and read in the
    web page.

    I'm still learning all the neuances of extensions, so my examples are probably
    wrong. But it's a starting point.

    Hope this helps.

    rprevost Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139