dongyingla8668 2015-09-23 21:02
浏览 52

页面源中的自定义JavaScript与粘贴的文件不同

In my Joomla (1.5) installation I'm getting errors presumably because the JS code as it's pasted into the index.php file (above </head>) is somehow changed when I look at the page source.

This is a set of screenshots of what's going on:

You can see my code is saying src="undefined"!==typeof, while the page source is saying src="/undefined"!==typeof.

I tried changing src="/undefined"!==typeof to src=typeof MIX...!=='undefined'?==typeof but it didn't help.

I get this in firebug:

ReferenceError: MIXPANEL_CUSTOM_LIB_URL is not defined

It's my analytics code for MixPanel, & it doesn't report page loads to my dashboard. I don't know how to get it to work.

  • 写回答

1条回答 默认 最新

  • dongzhou1901 2015-09-23 21:14
    关注

    I think the real issue is with joomla parsing the source index.php and converting that quote to a backslash for some reason. I am not a joomly kind of person, but I offer you these potential hacks to try to fix it quickly:

    Try putting parenthesis around the whole expression up until the semicolon.

    a.src=("undefined"!==typeof..........);
    

    Another hack... get rid of the ternary operator check for the variable, and always just define a.src using the else part from the original expression:

    a.src="file:"===e.location.protocol......;
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大