如何檢查頁面上是否設置了document.domain
並返回其值?jQuery - 如果存在,則獲取document.domain的值
更新
消極的攻勢之前,我想詢問的時候,它已經明確設置如何獲得document.domain的值。
我最終什麼樣的主意是
if(window.location.hostname !== document.domain)
這會告訴你,如果document.domain的已明確設置頁面上。
如何檢查頁面上是否設置了document.domain
並返回其值?jQuery - 如果存在,則獲取document.domain的值
更新
消極的攻勢之前,我想詢問的時候,它已經明確設置如何獲得document.domain的值。
我最終什麼樣的主意是
if(window.location.hostname !== document.domain)
這會告訴你,如果document.domain的已明確設置頁面上。
if(window.location.hostname !== document.domain)
是如何檢查是否document.domain的被明確設置 - 由document.domain的變量對主機名進行比較,如果上述返回爲true,然後在頁面上重新分配document.domain。
與訪問任何變量的方式相同。
你想用它做什麼? 「迴歸」它在哪裏?
舉個例子,你可以平凡流行起來的一個消息框:
alert(document.domain);
或者做任何你用它喜歡。
如果未設置,則結果將爲undefined
。
呃... ...你根本
document.domain
uhm ...'document.domain' – martriay 2013-02-24 22:23:15