-
Hello community! I have been working feverishly on creating a web app in Reflex for the past few days. I am aware that the use of web services on mobile devices is accelerating these days, and I was wondering if it would be possible to make this happen in Reflex in the form of a PWA. We will describe how we have done it successfully, but we understand that it is a hacky way to do it. Can you tell us if there is a better way or native support? *It seems to have been mentioned a bit in this Issue, but it looked like the tag that links manifest.json was not actually written in the head. (Please let me know if my understanding is wrong!) Thanks. Directory Structures
manifest.json
Python Script app = rx.App(
head_components=[
rx.script(
"""
document.addEventListener('DOMContentLoaded', function () {
var head = document.head;
// Create link to manifest
var linkManifest = document.createElement('link');
linkManifest.rel = 'manifest';
linkManifest.href = '/manifest.json';
head.appendChild(linkManifest);
});
""" |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
have you tried adding the app = rx.App(
head_components=[rx.el.link(rel="manifest", href="/manifest.json")]
) |
Beta Was this translation helpful? Give feedback.
-
@ppspps824 you're the man! Thanks this is really awesome! |
Beta Was this translation helpful? Give feedback.
-
Man, thank you so much, you saved me more 100+ hours |
Beta Was this translation helpful? Give feedback.
have you tried adding the
rx.el.link
tag directly?