Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
digitalpacman #1
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
-
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... -
CustomValidator and XMLHTTPRequest
yes. "Anatoly" <anatolyr@gilat.com> wrote in message news:#feBwBqVDHA.2248@TK2MSFTNGP10.phx.gbl... -
rprevost #2
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



Reply With Quote

