How to Form POST to Paypal from WinJS iframe Windows 8 App?

I have a Windows 8 App using Javascript/HTML and within an iframe I have a Paypal form:

<form action="" method="post" target="_blank">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="on0" value="Pages">
<select name="os0">
    <option value="10">$1.95</option>
    <option value="25">$2.95</option>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="encrypted" value="[removed]">
<input type="image" src="/btn_buynow_LG.gif" border="0" name="submit" alt="">

This form works perfectly fine in all browsers, including IE10 but when submitted from within the iframe in the Windows 8 App, it will lead the user to the Paypal homepage. This usually indicates an issue with the form. I have tried hosted Paypal buttons, encrypted, un-encrypted buttons and they all exhibit the same behavior. Only when I submit this form from within the Windows 8 App does it go to the homepage.

I have also tried adding every URL to my manifest as allowed URLs:

<Rule Match="" Type="include" />
<Rule Match="http://*" Type="include" />
<Rule Match="" Type="include" />
<Rule Match="http://*" Type="include" />
<Rule Match="" Type="include" />
<Rule Match="https://*" Type="include" />

I tried adding/removing the sandbox attribute and adding all combinations of the properties like so:

<iframe sandbox="allow-same-origin allow-top-navigation allow-forms allow-scripts allow-popups" src=""></iframe>

If I remove the target="_blank" then the Windows 8 App will navigate to a black screen and hang. I am forced to alt-tab and shutdown the app. I assume it's a problem with the form POST to a new window in another process.

How can I launch Paypal from within the iframe of a Windows 8 App?

Is a form POST required? I am now realizing that a form GET works.



Paypal will block the form POST to the new window when launched from an iframe in the Windows 8 App. The result is you see the Paypal homepage instead of the purchase order form.

I can confirm that simply switching the form method to GET and using a target="_blank" works perfectly without issue:

 <form action="" method="get" target="_blank">

Another way around this issue within the iframe is to use a standard anchor tag around text or an image and manually create the URL like so:

<a href="[custom info]&item_name=[URL encoded name]&item_number=[num]&amount=9.95&currency_code=USD&cmd=_xclick&business=[paypal email address]&return=[URL encoded URL]">Buy Now</a>

The credit for this answer goes to this page about Paypal links instead of buttons.


I don't think paypal allows iframe support. They most likely use this:

X-Frame Options

It allows them to detect if the page is rendered in a iframe and if so prevent it loading..(aka show blank page) like you are experiencing.

And there is no way around this.


I had a similar issue with PayPal and a Windows Store app. I just posted my solution to the problem in this thread:

Windows Store HTML app with popup window


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.