如何用offerwall iframe中的实际uid替换[USER_ID]

How to replace [USER_ID] with the actual uid in a offerwall iframe

本文关键字:替换 USER ID uid offerwall 何用 iframe      更新时间:2023-09-26

我正在创建一个GPT网站(付费到(,人们在这里完成报价会得到奖励,但我在将uid添加到报价墙的链接时遇到了问题示例:

<iframe src="https://example.com/api/?key=xxxxxx&uid=[USER_ID]" width="500" height="900" frameborder="0"></iframe>

如何用uid=12345替换uid=[USER_ID]?感谢

使用javascript可以执行str = str.replace("[USER_ID]", 123);其中str是包含uid=[USER_ID]的字符串因此字符串将为uid=1234

因此:

 <iframe id="iframeId" width="500" height="900" frameborder="0">
    <script>
        var str = "https://example.com/api/?key=xxxxxx&uid=[USER_ID]", 
            userId = 12345;
        document.getElementById('iframeId').src = str.replace("[USER_ID]", userId);
    </script>

将在中设置结果

 <iframe id="iframeId" src="https://example.com/api/?key=xxxxxx&uid=12345" width="500" height="900" frameborder="0">