Radar widget error message on a mobile page
-
Hello folks,
I'm coding a wordpress page which is kind of a weather forecasting game (wetterturnier.de) and I want to integrate windy's radar widget in the sidebar. But if access the page on a mobile device (tried several browsers) the following error message is shown:
(screenshot from my dev server)At first, I just copied the iframe code into the sidebar, got this error and so I looked for a cleaner way. Then I created a widget in my wp-plugin with "register_widget()" from the wordpress API. But the message still shows up. Actually the widget should not even be called because on wordpress mobile pages there is no sidebar.
Is there a way to prevent the iframe from loading by checking the user agent? Or could you make your code compatible to wordpress widgets?
https://developer.wordpress.org/themes/functionality/widgets/
Thanks in advance
Juri
-
Ok I figured it out with the User Agent. My workaround looks somehow like this: https://www.codespeedy.com/simple-php-code-to-detect-mobile-device/
I'm still wondering whether there is a more elegant solution to the problem.