Chinese URL loads correctly in Edge but not other browsers
Asked Answered
T

3

7

This page was developed in english which works well in Chrome and Edge browsers. Some community members asked then to translate it to Chinese. Same strategy to create the page was taken with the following resulting page.

The problem is that sometimes the Chinese version page doesn't load. Specially when pasting the URL from somewhere else. In the other hand when navigating from the landing page, blog area, it displays correctly.

How to fix that so that it works for every browser correctly. One interesting thing I just noticed was that sometimes copying the link results in:

https://ethereumclassic.github.io/blog/2017-08-27-社会币的崛起/

Sometimes in:

https://ethereumclassic.github.io/blog/2017-08-27-%E7%A4%BE%E4%BC%9A%E5%B8%81%E7%9A%84%E5%B4%9B%E8%B5%B7/

Telmatelo answered 3/9, 2017 at 13:0 Comment(5)
Something in your js (I would tend for a missing encodeURIComponent somewhere), disabling it loads the page correctly. Though, I don't think anybody will dig into the whole page to find out the culprit.Transact
It may be so that there is a relationship with this: #7185302Telmatelo
Since the page was generated with with Gatsbyjs I created an issue here too: github.com/gatsbyjs/gatsby/issues/2010Telmatelo
The page does load, it does not matter if chinese characters are URI-encoded or not, the problem is that after the page has loaded React will wipe out the content and replace it with empty node. Probably a bug in GatsbyJS, maybe because of chinese characters, maybe not, no idea at this point. What seems to matter is browser history (if you navigate from landing page, or if you open from another page or manually, history is different and this affects how GatsbyJS behaves). Try a breakpoint in ReactMount.js line 423.Abduction
It's visible that chinese page loads, then something in js removes body's contentJennings
N
3

check the vendor of bundle.js for updates. It appears to be an old version.

function webpackContextResolve(req) {
    return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());

// error occurs in above.
};

To debug web site load code, first navigate to a blank page (about:blank). Then display and pin the dev tool to the blank page.... select the debug tab of dev tools and choose "Break on All Exceptions" from the dropdown.. (looks like a Stop sign).

Without closing the dev tool, return to the blank page and navigate to the English and then the Chinese sites.... the dev tool will now break on errors. map undefined error To debug browser sniffing issues. (find code that uses browser userAgent sniffing to load different versions of a web site). Use the debug tab of the dev tool to find occurrences of "navigator" or "userAgent". find UserAgent sniffing code

You can test if a web site is incorrectly determining the browser features by changing the userAgent header from the Emulation tab of dev tools. Oddly, changing the UAS in dev tools in IE11 has the same result... suggesting that the enableLazy assignment in bundle.js is the cause. changing the UAS used by a browser with the Emulation tab var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge/\d/.test(navigator.userAgent);

bundle.js seems to be a problem.... check the vendors website for updates to their software....

Also... you have set the page language to en... it should be zh. eg.lang="zn"......

Nadaha answered 11/9, 2017 at 23:22 Comment(0)
M
0

I have detected some problems due to the url encoding and difference between lower and uppercase characters.

With PHP i am doing a URI conversion previous the router parse:

if(strpos($_SERVER['REQUEST_URI'], '%') > 0){
    $uri = $_SERVER['REQUEST_URI'];
    $result = preg_replace_callback(
        '/\%(\w{2})/',
        function ($matches) {
            return strtoupper($matches[0]);
        } ,
        $uri
    );
    $_SERVER['REQUEST_URI'] = $result;
}
Mythical answered 13/9, 2017 at 9:23 Comment(0)
J
0

Your problem is the bundle.js by removing it i obtained your webpage without any problem:

enter image description here

Did you put it in an unsupported event?

The js says:

  • NOTE: This will not work correctly for non-generic events such as change, * reset, load, error, and select. *
Jennings answered 13/9, 2017 at 11:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.