Automatically Launching Attachment in Web

Is there a way to open “First Attached” file automatically in web when document is opened. Something like “Launch First Attachment” option in Form properties. It does not work on Web.

I would like to issue a url like

http://www.abctest.com/content/marketing?opendocument

In this case marketing document has a PDF file that I would like to automatically open.

Any ideas.

Subject: Automatically Launching Attachment in Web.

Good question.

First thought I had was that this wouldn’t be possible. Secondly, after talking to a friend (Anil Vartak), this might be possible anyway. You might be able to parse the htmlpage in a body onload script, and then figure out if there is a attachment attached to the document. The way to do this, would be to check the links collection in Javascript.

The link collection is described here:

http://mozilla.org/docs/dom/domref/dom_doc_ref25.html#1025098

and here:

http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/document.html#1193918

So what does this mean?

Well, this link collection returns a collection of every href on your page. Meaning again - you can search through the array of these, to find typically href’s with “$files” in the strings, which in Notes/Domino is attachments within the document. So, when you find the first “$files” link - do a window.open on this url, and stop parsing the link collection array. Voila ! - You have opened the first attachment in the document!

Haven’t tried it, but it sure should work.

If you solve it - please share the Javascript!

Have a nice day,

Rune Carlsen

Founder Dominozone

http://www.dominozone.net

Subject: RE: Automatically Launching Attachment in Web.

Thanks for a great idea. I was able to accomplish it by adding a simple line to onLoad even of my page/form. I only had one attached file and no other links so did not have to read in to an array or do parsing.

var xlink=document.links[0];

this.location=xlink;

Regards

Subject: cool…