开发者

Upload contents of current html page from a bookmarklet

What would be a good way to upload the html content of the current page viewed in the browser to another server from a bookmarklet?

Assuming this url is on a server that requires authentication, so I want to avoid fetching the page on the sever side, but rath开发者_JS百科er would like to see if it's possible to get the contents and upload them directly from within the browser.

Thanks in advance for any suggestions

Elisha


Considering that you are most probably going to have a situation in which the page being viewed in the browser is on a different domain from the domain you want to send the data to, an AJAX request will definitely fail (due to Cross-Domain restrictions). So doing this server side would be your best bet.


  1. Retrieve location.href with XHR into string
  2. Create FORM with desired cross-site action
  3. POST data to server
  4. ?????
  5. PROFIT!
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜