Checking user's homepage in Internet Explorer

前端 未结 3 1684
眼角桃花
眼角桃花 2021-01-30 07:49

Google displays a popup that asks if you want to set your home page as google.com. It\'s quite normal, when I say OK it sets it as google.com. After that however, I don\'t get t

相关标签:
3条回答
  • 2021-01-30 08:24

    Internet Explorer makes it possible to ask it whether a given URL is the home page, it's detailed on this MSDN page. That links to this example page demonstrating the API.

    0 讨论(0)
  • 2021-01-30 08:41

    The code Google uses can be viewed here:

    google.promos.mgmhp.isGoogleHomepage = function (a) {
        var b = !1;
        try {
            b = window.external.isGoogleHomePage()
        } catch (d) {
            if (h(a)) return !0;
            var c = google.promos.gpd(a, "mgmhp_hp_url");
            c && g.push(c);
            for (c = 0; c < g.length; c++) {
                var k = g[c];
                if (b = b || a.isHomePage(k)) return !0
            }
        }
        return b
    };
    

    They are using the proprietary isHomePage method to check if google.com is your homepage. More info here.

    0 讨论(0)
  • 2021-01-30 08:47

    The following css code is the culprit.

    behavior: url(#default#homePage) url(#default#userData);

    this is why I don't really like IE. The behavior url(#default#userData) tells the browser to store this as session information on the client side or browser memory.

    More information here: http://msdn.microsoft.com/en-us/library/ms533015(v=vs.85).aspx

    0 讨论(0)
提交回复
热议问题