Back in 2010 I wrote about a solution for IE only: Open Windows directory with APEX (IE only)
The request itself appears at least once a year in one of my projects.
Nowadays I do not propose the workaround from 2010. It just doesn't fit in modern browsers.
Today I got another request to open a directory and this time I searched for 10 minutes and found a suitable solution working in IE, Firefox and Chrome.
As in 90% of each cases Stackoverflow showed me the way how I could to do it:
Stackoverflow Question: Open local folder from link
This solution creates a downloadable URL file including the target directory. The browser allows you to open directories from local files.
Unfortunately in Firefox and Chrome you need to download the LINK first and then execute it.
In IE you can open it directly.
This workaround is 100% HTML only and it is easy to integrate into APEX:
The request itself appears at least once a year in one of my projects.
Nowadays I do not propose the workaround from 2010. It just doesn't fit in modern browsers.
Today I got another request to open a directory and this time I searched for 10 minutes and found a suitable solution working in IE, Firefox and Chrome.
As in 90% of each cases Stackoverflow showed me the way how I could to do it:
Stackoverflow Question: Open local folder from link
This solution creates a downloadable URL file including the target directory. The browser allows you to open directories from local files.
Unfortunately in Firefox and Chrome you need to download the LINK first and then execute it.
In IE you can open it directly.
This workaround is 100% HTML only and it is easy to integrate into APEX:
DECLARE L_BLOB BLOB; L_CLOB CLOB; L_DEST_OFFSET INTEGER := 1; L_SRC_OFFSET INTEGER := 1; L_LANG_CONTEXT INTEGER := DBMS_LOB.DEFAULT_LANG_CTX; L_WARNING INTEGER; L_LENGTH INTEGER; BEGIN -- create new temporary BLOB DBMS_LOB.CREATETEMPORARY(L_BLOB, FALSE); -- Create file source including the target directory SELECT '[InternetShortcut]'||CHR(13)||'URL=file:///D:' INTO L_CLOB FROM DUAL; -- tranform the input CLOB into a BLOB of the desired charset DBMS_LOB.CONVERTTOBLOB( DEST_LOB => L_BLOB, SRC_CLOB => L_CLOB, AMOUNT => DBMS_LOB.LOBMAXSIZE, DEST_OFFSET => L_DEST_OFFSET, SRC_OFFSET => L_SRC_OFFSET, BLOB_CSID => NLS_CHARSET_ID('WE8MSWIN1252'), LANG_CONTEXT => L_LANG_CONTEXT, WARNING => L_WARNING ); -- determine length for header L_LENGTH := DBMS_LOB.GETLENGTH(L_BLOB); -- first clear the header htp.flush; htp.init; -- create response header including the filename ending with .url OWA_UTIL.MIME_HEADER( 'application/internet-shortcut', FALSE); htp.p('Content-length: ' || L_LENGTH); htp.p('Content-Disposition: inline; filename="URIShortcut.url"'); htp.p('Set-Cookie: fileDownload=true; path=/'); OWA_UTIL.HTTP_HEADER_CLOSE; -- download the BLOB WPG_DOCLOAD.DOWNLOAD_FILE( L_BLOB ); -- stop APEX APEX_APPLICATION.STOP_APEX_ENGINE; END;