These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

app.launchURL(url,false) launches url in new tab for firefox.

subhrajyotim
Registered: Feb 5 2009
Posts: 4
Answered

Hi,

I have a acroform, which is embedded in an iframe like the example below:

The acromform has some text fields and a submit button, which submits (POST) to a server script (j2ee servlet in my case). The response content type can only be PDF/FDF type.

I want to redirect to another landing page giving some info to the user AFTER the user has hit the submit button and got the response back from the servlet.
Basically once the request-response cycle has been completed for the acroform submit.

To accomplish this, i send a PDF content type response to the form submit , which has the below javascript:

app.launchURL("http://www.infopage.com/infopage",false);

On Firefox this opens the URL in a new tab. For IE it opens in the same window.
Is there a browser independent way to accomplish this feat, from within the embeded reader in the browser?
Is there a way to identify whether the form submit from the browser embeded pdf or from a offline pdf reader, not within the browser.

I notice that the User-agent header of the submit request has

user-agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5

in case of firefox embeded PDF submit. in case of offline viewer, i get
user-agent:AcroForms

is this a reliable way to solve the "request coming from" issue.

OR i should look into iframe events and all those DHTML/AJAX thingy to deal with this.

Please help!! I am stuck with this for a long time now!!

Thanks,
Subhro.

My Product Information:
Reader 9.0, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
What I would do is return an FDF response that simple contains a /F key that points to the page you want to redirect to.

George
subhrajyotim
Registered: Feb 5 2009
Posts: 4
Hi George,
You made my day!!!

The user-agent HTTP header values for "a embedded acroform POST" and "a offline reader acroform POST" are different. This seems like a reliable enough way to detect the two different request types.
For both the request types i set FDF content. For the embedded form response i set it to "myhomepage/anypage.jsp/asp/php". For offline reader, i set it to a PDF file (actually dynamically generated PDF content stream). This did the trick. Not sure how reliable this is. For now it will work.
Thank you very much for showing me the light!!! :)

BTW, I am using iText for doing all this. Its offers quite a set of open source java APIs to manipulate PDFs.

Thank you,
Subhro.