I had a quick look at the code (gramps/gramps/plugins/webreport/place.py) and generated HTML.
The map is contained in a <div id="map_canvas"></div> which is just a placeholder to be manipulated by JavaScript. I thought I could trick the GET request by adding a “simple” Referer:https://localhost header. Unfortunately, I don’t understand what the script does. This probably needs learning both the canvas feature and OpenLayers API.
Thanks Patrick
I have also had a brief look at this with tentative questions to Claude
and Perplexity both came back with responses that would require an
expert programmer to interpret not the dumb tweaker that I am.
So for the moment I have no use for the Narrative Web Report because the
Places and Heatmaps were becoming more and more important especially
when showing to others.
phil
Just had this from Openstreet, not had time to investigate but was wondering if it made sense to anybody before I try playing
phil
This is now fixed in GOL Tool 2.3.7 ([download](https://www.geodesk.com/download)) and GeoDesk for Python 2.2.5 (`pip install geodesk -U`). Thanks for your patience!
- `X-Requested-With` headers are *only* sent for the default map (OSM Carto). If you're setting a custom basemap, these headers are not sent (to avoid problems with tileservers that don't understand them)
Bottom line… I just checked my site on the hard drive and the maps are displaying the 403 error. Unless this changes, I’ll assume this OSM “fix” does not apply to our usage.
But curiously, the same local website on an android tablet does display the map. I had to add Simple HTTP Server to the tablet. Chrome would not open a file stored on the tablet.
Hi Dave agreed suspect it is a change in the way the map tiles are
produced so that the referer header is not required so not sure if
Narrative Web needs modified or some element of python needs added or
upgraded or both.
phil
I also ran into this issue where interactive OpenStreetMaps maps fail to render (well, are blocked from rendering) on a static site when viewed from a local drive or USB flash drive with the file:/// protocol, while working fine when served via a local web server, http://localhost.
If I were generating the static site for just myself, I would just use localhost, but I’m trying to share my research with less techie family members.
A workaround I ended up with is post-processing the generated HTML files to swap the default OSM tile URL with ESRI’s World Topo tile service: [https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/](https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/){z}/{y}/{x}
Gemini wrote a script to post-process greatgramps static files to add maps back in using ERSI maps. I would think this would be possible with Narrated Web Site files, but I haven’t done it.
Unlike OSM, ESRI does not enforce strict Referer checks on these public basemap tiles, nor does it require an API key or display watermarks (unlike CARTO). A Python script or sed command running across the generated HTML directory to replace the tile URL restores working maps for completely portable, offline USB distribution.
(I also have a Gramps Web install behind a Cloudflare tunnel and think it’s a great program, but I’m trying to give users the information in a format they are most comfortable with. And for some, a USB stick is easy-peasy and for me, And I am more comfortable sharing a USB drive with a wider circle than my NAS.)
With narrative web, the maps are depending on openlayers.
The last version is 10.10.0
Did you try to use an older version.
You can do that modifying gramps.ini:
The problem is more complicated than it appears at first sight.
NarrativeWeb creates static HTML pages which can be displayed two ways at user’s choice.
for those tech-savvy, served by a local web server
This is the most homogeneous method because everything is HTTP from start to end. The browser adds the necessary headers to the request and these headers, like Referer, are also used for secondary GET requests.
for common users, shown with File → Open File
HTTP protocol is completely bypassed. No header is generated because there is no request, simply file retrieval which is fully specified by the filename. Then secondary GET requests for OSM tiles have no “context headers” to attach.
The problem is not in NarrativeWeb, nor in Gramps. It is in the browsers. It is likely a short sight in design: requests and file retrieval are separate. There is no HTTP request in the second case. But designers did not take into account that HTML files could need auxiliary data from the net. and thus need “identification” or “context” headers.
IMHO, there is nothing that can be done in Gramps: HTTP headers are not members of HTML files; they are added by the browser at request time.
I tried to outsmart Firefox adding a <meta http-equiv=Referer content="http://localhost">. But it did not change. This seems to be logical: since opening files is not HTTP protocol, this meta element is meaningless and ignored. It seems also not to override the standard Referer header when used through HTTP.
My Browser is Firefox with default value of 2, it does not work. Chromium browser used to work until I foolishly asked on Openstreet why this should be. And one of the volunteers came back to explain it should not work on Chromium either. he thanked for me pointing this out and corrected the blocking mechanism on Openstreet so that Chromium now no longer works.
Which Browser are you using
They did suggest work rounds which are beyond my understanding and I have posted these on the list
Could I add to this my thoughts as to why we are where we are.
Murphy’s Laws
Number 3
“Best intention’s inevitably give rise to unintended consequences.”
The scenario runs like this
Somebody at Web Content Providers (ie Openstreet) notices that they are getting a lot of service outages due to bot attacks, decides to talk to his/her mate at Mozilla (other browser providers are available) can you help here he says so nice person at Mozilla says yes leave it with me.
Lo sometime later we get the “referer” (obviously developer could not spell) defence and it gets implemented now the man on the street notices his nice static website no longer works and takes it up with the content provider who checks with the browser provider who says yes we know about that but there are not many complaints just reply it is being worked on (code for it is going into the long grass). Thus GRAMPS Narrative Web Report (static site) being at the bottom of the food chain has a problem.
The Report was a nice simple way of presenting a lot of information to people who can plug a USB Stick into a computer (but little else, obviously a minority sport) without having to setup a web server.
This will be my last comment on this topic as I have spent too much time chasing my tail round the net for a simple fix.
No problem when page served through local NginX; OSM blocked if I open file directly (and it seems logical because there is no referrer when opening a file).
The latest 2 or 3 versions of firefox offer to spin up a local server for you.
If you open the site from file, then go to developper tools ( hit F12 ) firefox offers to spin up a server and access the site via localhost (somewhere in the top right corner). I’ve not tested this with OSM specifically, but it did work in other situations where a site from file did not work.
The downside is that you need to do it each time you load the file.
Starting with Firefox 153.0, you can configure a “fake” localhost server according to
I added a setting for http://osm.localhost pointing to my directory. Then, I entered osm.localhost in the URL bar. I navigated to a place page and the OSM tile is there.
Don’t forget to activate Web Development Tools before asking for the “fake” web server otherwise FF will try HTTPS and reject the request.
Whilst this works it is definitely not user friendly ie more than basic
computer skills are required, also the development window takes up a
significant chunk of the user screen.
So not practical for passing a usb stick to a family member even worse I
suspect if trying to give a presentation.
Will have to look at the Narrative Web code again to see if a mod is
possible but not in the immediate future and probably outwith my
technical ability.
phil
Thanks for the suggestions
I don’t think so. What you could change is page “contents” while the behaviour is related to the protocol used to display the page.
When you http://… to a page, you’re entirely inside HTTP and a Referer header is sent. With file:///…, you are not in a remote protocol, you access files directly on your computer and headers are not meaningful (most of them if not all are not generated because there is no use for them).
What you would need is the possibility to generate HTTP-headers but there is no way to do so when static pages are stored. HTTP-headers are sent by the server before page transmission begins. This could be done if Gramps was turned into some kind of web server engine but we won’t then have a collection of static pages. And any way, this no longer works when the static pages are put on a USB stick without going through a web engine.