The Dreamweaver JavaScript API > External application functions > dreamweaver.browseDocument() |
Availability
Dreamweaver 2.0, enhanced in 3.0 and 4.0.
Description
Opens the specified URL in the specified browser.
Arguments
fileName, {browser}
fileName is the name of the file to be opened, expressed as an absolute URL. |
|
browser, added in Dreamweaver 3, specifies which browser to use. This argument can be the name of a browser as defined in the Preview in Browser preferences or either 'primary' or 'secondary'. If omitted, the URL is opened in the user's primary browser. |
Returns
Nothing.
Enabler
None.
Example
The following function uses dreamweaver.browseDocument() to open the Hotwired home page in a browser:
function goToHotwired(){
dreamweaver.browseDocument('http://www.hotwired.com/');
}
In Dreamweaver 4, you can expand this operation to open the document in Internet Explorer using the following code:
function goToHotwired(){
var prevBrowsers = dw.getBrowserList();
var theBrowser = "";
for (var i=1; i < prevBrowsers.length; i+2){
if (prevBrowsers[i].indexOf('Iexplore.exe') != -1){
theBrowser = prevBrowsers[i];
break;
}
}
dw.browseDocument('http://www.hotwired.com/',theBrowser);
}
For more information on dw.getBrowserList(), see dreamweaver.getBrowserList().