html的iframe页面给帆软BI发送消息

需求:帆软的网页组件嵌套一个HTML页面,HTML页面要给帆软发消息。

解决方法是:fineReportWindow.duchamp.getWidgetByName("txt1").setValue('666');

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>HTML Page for FineReport</title>

</head>

<body>

<button id="sendButton">发送消息</button>

<script>

// 获取按钮元素

var sendButton = document.getElementById('sendButton');

// 向帆软发送消息的函数

function sendMessageToFineReport(message) {

// 假设 parent 是帆软的窗口对象,这里需要根据实际情况修改

var fineReportWindow = parent;

// 使用 postMessage 发送消息

fineReportWindow.postMessage(message, {});

fineReportWindow.XXX=1;

console.log(fineReportWindow);

fineReportWindow.duchamp.getWidgetByName("下拉框1_页面1").setValue('87897232');

//window.postMessage(message, '*');

}

// 监听按钮点击事件

sendButton.addEventListener('click', function() {

sendMessageToFineReport('999');

});

</script>

</body>

</html>

注意不要跨域,html页面可以丢到帆软的安装目录下。这样就同一个域名了

相关推荐
石小石Orz17 分钟前
浏览器的预检请求OPTIONS到底有什么用?
前端
落雪小轩韩20 分钟前
网格布局 CSS Grid
前端·css
parade岁月23 分钟前
Vue 3 父子组件模板引用的时序陷阱与解决方案
前端
xianxin_27 分钟前
CSS Outline(轮廓)
前端
moyu8428 分钟前
遮罩层设计与实现指南
前端
Sammyyyyy33 分钟前
2025年,Javascript后端应该用 Bun、Node.js 还是 Deno?
开发语言·javascript·node.js
Pedantic37 分钟前
用 SwiftUI 打造一个 iOS「设置」界面
前端
timeweaver43 分钟前
深度解析 Nginx 前端 location 配置与优先级:你真的用对了吗?
前端·nginx·前端工程化
鲸落落丶44 分钟前
网络通信---Axios
前端
wwy_frontend1 小时前
React性能优化实战:从卡顿到丝滑的8个技巧
前端·react.js