gpt4 book ai didi

javascript - Docusign 登录过程完成后如何重定向出 Iframe

转载 作者:行者123 更新时间:2023-12-02 22:49:42 30 4
gpt4 key购买 nike

我希望用户在 Docusign Iframe 上完成签名后将其重定向到我网站的其他部分,但我无法退出 Iframe。我知道这个问题已经在这里被问过,但没有答案:Here

Here但用户提供的代码在我的情况下不起作用,新页面甚至无法加载:

<iframe id ="docusignFrame" name="docusignFrame" th:src="${docusignURL}" width="100%" height="900" onLoad="(this.contentWindow.location != '' ? DocusignCompleted(this.contentWindow.location) : void(0));"></iframe>
<script>
function DocusignCompleted(url) {
$("#docusignFrame").hide();
}
</script>

我尝试过的:

PHP 代码:

$recipientViewRequest = new DocuSign\eSign\Model\RecipientViewRequest([
'authentication_method' => $authenticationMethod, 'client_user_id' => $clientUserId,
'recipient_id' => '1', 'return_url' => $baseUrl . '/' . "end_print.php",
'user_name' => $signerName, 'email' => $signerEmail
]);
$results = $envelopeApi->createRecipientView($accountId, $envelopeId,
$recipientViewRequest);
return $results['url'];

HTML 代码:

<iframe src="<?=$result?>" width="1000" height="1000"></iframe>

这可能吗,仅使用 HTMLPHP 还是我必须像上面的用户一样尝试 JavaScript 中的某些内容。

任何形式的帮助将不胜感激,谢谢。

最佳答案

我已经找到了针对我的情况的解决方案,它是检查 Iframe 的 onload ,然后在 Javascript 中检查 GET["event Docusign 的 "] 已存在。

在这种情况下,如果签名过程失败,它仍然会更改页面,但您可以将这部分代码更改为您想要的事件。

<html>
<head>
<script>
function handleIframe(str){
url = new String(str);
if (url.indexOf('?event=signing_complete') > 0) {
window.top.location.href = "signing_complete.php";
}
}
</script>
</head>
<body>
<iframe width="1000"
height="1000"
onload="handleIframe(this.contentWindow.location)"
frameborder="0"
src="<?=$result?>">
</iframe>
</body>
</html>

我目前正在修复以下错误,如果发现我也会将其发布到此处。

Uncaught DOMException: Blocked a frame with origin "http://localhost" from accessing a > cross-origin frame. at new String () at handleIframe [...] at HTMLIFrameElement.onload [...]

关于javascript - Docusign 登录过程完成后如何重定向出 Iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58233411/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com