upload_callback.html 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. </head>
  6. <body>
  7. <!--
  8. 这是同域下的callback页面,本页面在iframe内,所以只要通过window.parent就能操作父窗口的元素
  9. -->
  10. <script type="text/javascript">
  11. var query = {};
  12. var urlParams = window.location.search.split('?')[1];
  13. urlParams = urlParams.split("&");
  14. for (var i = 0; i< urlParams.length; i++)
  15. {
  16. var param = urlParams[i].split("=");
  17. query[param[0]] = param[1];
  18. }
  19. var imageDialog = window.parent.document.getElementById(query['dialog_id']);
  20. if (parseInt(query['success']) === 1)
  21. {
  22. imageDialog.querySelector("[data-url]").value = query['url'];
  23. }
  24. else
  25. {
  26. alert(query['message']);
  27. }
  28. location.href = "about:blank";
  29. </script>
  30. </body>
  31. </html>