How do I show an error page when users visit my site using Microsoft Edge?

不问归期 提交于 2020-01-11 11:39:11

问题


When a user loads my website in Microsoft Edge, I need to show a page like in the below image:

I can see like this page when I'm trying to access sites like www.naver.com or www.daum.net on Edge.

That page looks like a Provided from Microsoft , and I guess there are Any Javascript function to call this pages

I need to know how ..


回答1:


If possible you should avoid browser detection and move to modern web technologies that work across browsers. A great tool you can use is the sitescan on http://dev.modern.ie/tools/staticscan/ that helps to identify common issues, like outdated js libraries or css prefixes.

If your app requires legacy technology like activeX or other IE specifics you can:

  • have your site added to to compatiblity list managed by Microsoft (for public sites)

  • or create an enterprise site list for your company / intranet pages which determines which pages to open in IE instead of Edge.

Charles provided some details here: https://stackoverflow.com/a/31283160/5138360




回答2:


In my opinion you're going about this the wrong way, I know supporting new browsers may be frustrating, but you're only delaying work that needs to be done (in this case, supporting Edge when Internet Explorer's usage will be at a decline in the next few years).

However, what you're asking can be done with PHP's get_browser() function; you should check if the user-agent string has 537.36 Edge present, and if so show the error message; if not show the normal content:

<?php 
    if (strpos(get_browser(),'537.36 Edge') !== false) {
        echo "Edge Browser Detected";
    }
    else
    {
       echo "You are not running Edge.";
    }

?>

Where echo "Edge Browser Detected";, replace with your error page, where echo "You are not running Edge.";, replace with your normal page content.

If you receive this error, refer to this question on how to fix:

WARNING get_browser() [function.get-browser]: browscap ini directive not set on line number 2




回答3:


As mentioned in this thread: http://answers.microsoft.com/en-us/insider/forum/insider_internet-insider_spartan/ms-edge-show-alert-titled-this-website-needs/7771eb86-7b4d-440c-bc4d-43a88d1e489d

You may run a scan of your site here: http://dev.modern.ie/tools/staticscan/?url=http%3A%2F%2Fnaver.com

When you do so, there's an information message regarding the "Rendering Mode":

There is an issue with this website that could force an old rendering mode.

We’ve found that this webpage was added to a Compatibility View list when a user reported a compatibility issue while browsing in Microsoft Edge. For this reason, your site will render in Internet Explorer 11 on Windows 10 as a fallback. We recommend that you use modern markup for all modern browsers and include Microsoft Edge in your test matrix.

So there you go, it seems that the website needs to be reported as incompatible for Edge to display this message. However, i'd be surprised if Microsoft added all reported sites to their compatibility list (I bet the site has to be of some significance and several users need to report the site).

Please see https://stackoverflow.com/a/31283160/1010492 on how to have your site added to the compatibility list.



来源:https://stackoverflow.com/questions/31538683/how-do-i-show-an-error-page-when-users-visit-my-site-using-microsoft-edge

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!