Paypal Button For Google Chrome Extension

有些话、适合烂在心里 提交于 2019-12-30 03:24:07

问题


I'm attempting to add a donate button (because I like money) to my google chrome extension. I'm having trouble with it because the Chrome extension tries to open the paypal created donation button in the popup.html window. When I click the button, my extension just restarts and there is no donation window.

I have tried using chrome.tab.create() to try to make it open to a tab but it doesn't seem to have any effect.

The code to the donation button is as follows:

<form action="chrome.tabs.create ({'url': 'https://www.paypal.com/cgi-bin/webscr'});" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXXXXXXX">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">

Any help with this would be great!

Thanks


回答1:


Try a link instead of a form: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=xxxxxxx




回答2:


Instead of:

<form action="chrome.tabs.create ({'url': 'https://www.paypal.com/cgi-bin/webscr'});" method="post">

Try:

<form action="https://www.paypal.com/cgi-bin/webscr" target="_blank" method="post">



回答3:


To add on to PayPal_Robert: If you still want the PayPal donate image linked in there, try:

<a target='_blank' href='https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=xxxxxxxx'>
  <image src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0">
</a>

Just change the hosted_button_id parameter to your own.



来源:https://stackoverflow.com/questions/7438292/paypal-button-for-google-chrome-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!