【问题标题】:navigator not found in javascript-birt report在 javascript-birt 报告中找不到导航器
【发布时间】:2016-08-18 11:44:03
【问题描述】:

我正在 birt 中实现 javascript 来检查机器的操作系统,因为我正在制作响应式报告。

这是我的 javascript

if(navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i)){

var a = document.getElementsByTagName('svg');
    var i =0;
    for (i = 0;i< a.length;i++) 
    {
        a[i].style.width = '384px';
    }

    a = document.getElementsByTagName('embed');
     i =0;
    for (i = 0;i< a.length;i++) 
    {
        a[i].width = '384px';
        a[i].initialWidth = '384px';
    }
}

当我在浏览器上加载它时出现以下错误

ReferenceError:未定义“导航器”。 (/report/method[@name="beforeRender"]#1)

【问题讨论】:

    标签: javascript birt


    【解决方案1】:

    navigator 是 Web 浏览器中 window 对象的属性。您只能在 javascript 文件中访问它在网络浏览器中运行

    【讨论】:

      猜你喜欢
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-29
      • 2017-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多