Hi, > I know that target is a no-no for standards (and it seems IE is the > only one obeying it this time around!).
How is `target` on an `a` element not standard? http://www.w3.org/TR/html5/links.html#attr-hyperlink-target > How do I do this? The real url is supplied at runtime via an AJAX > request. I can assign it to whatever is needed. The way I've done it to do this in response to a button click is to use a `form` element, update its action, and submit it (either by making the button a submit button or by cancelling the click event from the button and calling form.submit directly). `target` is valid on forms: http://www.w3.org/TR/html5/association-of-controls-and-forms.html#attr-fs-target So vaguely like this (not tested): <form action='#'> <button id='vsViewJobsheetButton'>View jobsheet</button> </form> $('jsViewJobsheetButton').observe('click', function(event) { var form; event.stop(); form = this.up('form'); form.action = /* the derived action URL */; form.submit(); }); Separately: I think the default in nearly any browser for PDFs is to view inline, but you might want to make sure you include a Content- Disposition: inline header in the response anyway, as an added hint. HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Aug 13, 4:06 pm, Richard Quadling <[email protected]> wrote: > Hi. > > I want to press a button to open a new tab showing a PDF file. > > Currently, I have ... > > <a id="vsFax" target="_blank" href="/index.php" title="Jobsheet" > class="formButtons"> > <button id="vsViewJobsheetButton">View jobsheet</button> > </a> > > and each browser resulted in a different outcome (Chrome:new tab OK, > Firefox:2 new tabs both OK, IE:nothing, Safari:new window) > > I know that target is a no-no for standards (and it seems IE is the > only one obeying it this time around!). > > So. > > How do I do this? The real url is supplied at runtime via an AJAX > request. I can assign it to whatever is needed. > > I could just style the <a> as a button ... is that possible? > > Any suggestions? > > Regards, > > Richard Quadling. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
