Custom page not working when using T2M (React, TypeScrypt) - Printable Version +- Ewon Technical Forum (https://techforum.ewon.biz) +-- Forum: Development (https://techforum.ewon.biz/forum-50.html) +--- Forum: Custom Web Pages/viewON/Talk2M Visualization (https://techforum.ewon.biz/forum-55.html) +--- Thread: Custom page not working when using T2M (React, TypeScrypt) (/thread-1025.html) |
Custom page not working when using T2M (React, TypeScrypt) - ktmachinex - 25-09-2019 Hi, I've created a custom web page using React framework and TypeScrypt. I then put it on the ftp of the ewon flexy 205 and configure the device to open by default on the custom page. Locally, when entering the ip address of the ewon, I can see my custom page and it works perfectly. The problem occurred when I'm trying to access to my custom page while using T2M. It seens, the page has a problem reading the manifest.json file that I provided along the index.html page. See the attachment for more info. Any idea why my page does not work when using T2M? Thanks in advance, ktmachinex RE: Custom page not working when using T2M (React, TypeScrypt) - simon - 02-10-2019 Hi, When you develop pages that must be seen through M2Web, you have to be careful to the links you use. Indeed, M2Web parses your pages to replace the coded links by https://M2web.talk2m.com/account/ewon/restOfUrl. If you want we have a closer look at your case, the best is to contact your local support representative. Simon RE: Custom page not working when using T2M (React, TypeScrypt) - ktmachinex - 02-10-2019 (02-10-2019, 01:21 PM)simon Wrote: Hi, Hi Simon, Thanks for the reply. Is there any documentation about what I should be careful about when creating custom pages to have it work on M2Web? I think my problem might have to do with using the react framework, how I create my routes within my custom page and/or how I manage my history (by hash). I'll try to contact my local support representative. Thanks again for all the help provided, ktmachinex RE: Custom page not working when using T2M (React, TypeScrypt) - simon - 03-10-2019 Hi, Regarding your question "Thanks for the reply. Is there any documentation about what I should be careful about when creating custom pages to have it work on M2Web?", no there is no doc for that unfortunately. If you develop it from scratch, I think that as long as you use relative links, everything should work fine in M2Web. Usually what makes troubles is when absolute links are computed from the javascript... Simon RE: Custom page not working when using T2M (React, TypeScrypt) - ktmachinex - 03-10-2019 Hi, All seems to point towards the navigation link href attribute. Code: // Is equal to this when view locally Now I'm trying to figure the proper fix to this. Thanks for your time. Any help is always welcome, ktmachinex RE: Custom page not working when using T2M (React, TypeScrypt) - simon - 08-10-2019 Hi, You should perhaps use a relative link like "settings/ewon" or "../../settings/ewon" ? Simon RE: Custom page not working when using T2M (React, TypeScrypt) - ktmachinex - 31-10-2019 I finally found the problem / issue.
Is this behaviour expected when using Talk2M (I'm no web developer expert by no mean)? To fix the issue, I added a wildcard ('*') to every route like this: Code: <Switch> Here's the code I used to found the behaviour (the file was named App.js): Code: import React, { Component } from "react"; Thanks for your time. It's always much appreciated. Have a nice day, ktmachinex RE: Custom page not working when using T2M (React, TypeScrypt) - simon - 07-11-2019 Hi, Yes, to me, this is an expected behavior. M2Web searches all links to replace them by m2web.talk2m.com/account/ewon/... Very happy that it works now :-) Simon |