Mobile Ready Site Addition |
Post Reply |
Author | ||
chartman
Newbie Joined: Dec 23 2020 Location: NY,USA Status: Offline Points: 5 |
Post Options
Thanks(0)
Posted: Apr 28 2021 at 12:01am |
|
Hi Hobby001, I left a request for help on the support forum because I could not get my dynamic webpages to display on a mobile device. I have deliberately not made the website responsive due to the format of the site, plus the fact that there are only several page to the entire site. Therefore I have made mobile designed pages for each of the full screen pages. In order to display these mobile pages, I used the method from one of your posts (media redirect issues) in which you suggest using a small javascript routine to redirect to the mobile page according to a media query match as follows; <script> function myFunction(x) { if (x.matches) { document.location = "https://www.fxchartdata.com/mobile/m_Home.htm"; } } var x = window.matchMedia("(max-width: 700px)") myFunction(x) // Call listener function at run time x.addListener(myFunction) // Attach listener function on state changes </script> I have inserted this method in the header area of my index.htm page. However it does not appear to be having any effect. Can you try to access the site (fxchartdata.com) with a mobile device and see why it might not work ? The redirection location is fxchartdata.com/mobile/m_home.htm.
|
||
Chartman
|
||
Hobby001
Admin Group Joined: Jun 05 2018 Location: Canada, Québec Status: Offline Points: 6195 |
Post Options
Thanks(0)
|
|
This code works fine
The error is somewhere else, the two following lines have nothing to do with javascript. Removing them should solve the issue.
If you want them into your page add them into an html code block. |
||
chartman
Newbie Joined: Dec 23 2020 Location: NY,USA Status: Offline Points: 5 |
Post Options
Thanks(0)
|
|
When you say "this code works", I would think you mean yes your webpage is working correctly and I see the mobile page on a mobile device. But I have tried to access the page on several mobile devices using chrome and opera and it doesn't work even after taking out the other two lines. Unless you mean that the code I have shown on the post should work but we don't know why it doesn't.
|
||
Chartman
|
||
Hobby001
Admin Group Joined: Jun 05 2018 Location: Canada, Québec Status: Offline Points: 6195 |
Post Options
Thanks(0)
|
|
It does not work on your site because you did it wrong
Remove what's in red |
||
Hobby001
Admin Group Joined: Jun 05 2018 Location: Canada, Québec Status: Offline Points: 6195 |
Post Options
Thanks(0)
|
|
OpenElement generates the <script></script> tags for you
Therefore the ones you added to the script are misinterpreted by the browswers Edited by Hobby001 - May 05 2021 at 2:14am |
||
Hobby001
Admin Group Joined: Jun 05 2018 Location: Canada, Québec Status: Offline Points: 6195 |
Post Options
Thanks(0)
|
|
Now you have another issue
this codes generates: (index):48 Uncaught TypeError: Cannot set property 'innerHTML' of null at (index):48 You can use:
To change the text block value where WEcbad572bfa is an openElement text block. Edited by Hobby001 - May 06 2021 at 12:54pm |
||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |