簡體   English   中英

谷歌分析 Javascript 錯誤

[英]Google Analytics Javascript error

我有這個頁面,它曾經返回一些其他 JavaScript 錯誤,但似乎我已修復它們,因為系統現在抱怨不同:)

這是頁面:

http://www.comehike.com/outdoors/parks/trailhead.php

這是我在控制台中遇到的 JS 錯誤:

無法向http://googleads.g.doubleclick.net發布消息。 收件人的來源是 http://www.comehike.com

還有這個非常神秘的錯誤:

Unsafe JavaScript attempt to access frame with URL http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-1884332214318974&output=html&h=90&slotname=6750679790&w=728&lmt=1307311140&flash=10.3.181&url=http%3A% 2F%2Fwww.comehike.com%2Foutdoors%2Fparks%2Ftrailhead.php&dt=1307285940734&bpp=5&shv=r20110527&jsv=r20110506&correlator=1307285940857&frm=4&adk=540157337&ga_vid=898509444.1299013740&ga_sid=1307285941&ga_hid=824315563&ga_fc=1&u_tz=-420&u_his=10&u_java=1&u_h=768&u_w=1366&u_ah= 720&u_aw=1366&u_cd=32&u_nplug=14&u_nmime=51&biw=1345&bih=149&ref=http%3A%2F%2Fwww.comehike.com%2F&fu=0&ifi=1&dtd=291&xpc=egJ5ygbjaM&p=http%3A//www.comehike.com from frame with URL http://googleads.g.doubleclick.net/pagead/ads?client=ca-pub-1884332214318974&output=html&h=90&slotname=6750679790&w=728&lmt=1307311140&flash=10.3.18 tp%3A%2F%2Fwww.comehike.com%2Foutdoors%2Fparks%2Ftrailhead.php&dt=1307285940734&bpp=5&shv=r20110527&jsv=r20110506&correlator=1307285940857&frm=4&adk=540157337&ga_vid=898509444.1299013740&ga_sid=1307285941&ga_hid=824315563&ga_fc=1&u_tz=-420&u_his=10&u_java=1&u_h= 768&u_w=1366&u_ah=720&u_aw=1366&u_cd=32&u_nplug=14&u_nmime=51&biw=1345&bih=149&ref=http%3A%2F%2Fwww.comehike.com%2F&fu=0&ifi=1&dtd=291&xpc=egJ5ygbjaM&p=http%3A//www.comehike.com . 域、協議和端口必須匹配。

知道它們為什么會發生以及如何解決它們嗎?

這是我嘗試在 AJAX 中返回 XML 的方法:

    echo '<markers>';

    $str =
    <<<EOD

    <marker>
    trail_id=$trail_id
    trailhead_id=$trailhead_id
    park_id=$park_id
    editor_member_id=$editor_member_id
    trailhead_name=$trailhead_name
    trailhead_description=$trailhead_description
    parking=$parking
    cost_details=$cost_details
    parking_spots=$parking_spots
    is_free=$is_free
    wheelchair_accessible=$wheelchair_accessible
    bathrooms_nearby=$bathrooms_nearby
    lat=$lat
    lng=$lng

    </marker>
    EOD;

    echo $str;

// End XML file
echo '</markers>';

該錯誤很可能是頁面上發生的其他事情的副作用。 特別是谷歌地圖 API。 Firefox 拋出的錯誤是Error: uncaught exception: [Exception... "An invalid or illegal string was specified" code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://maps.gstatic.com/intl/en_us/mapfiles/api-3/5/5/main.js Line: 93"] 我會嘗試從頁面中刪除所有與谷歌地圖相關的內容,看看頁面加載是否沒有錯誤。 此外,我會嘗試創建另一個空白頁面,並按原樣復制與該頁面相關的所有谷歌地圖,看看是否只有谷歌地圖代碼運行沒有錯誤。 這將告訴我:1)與 map 一起使用的代碼正在做一些時髦的事情,或者 2)谷歌地圖代碼與頁面上的其他內容沖突。

PS 我懷疑罪魁禍首是 initializeTrailheads() 方法。 嘗試從 onload 中刪除它,看看會發生什么。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM