MappView PDF Viewer without same origin

Hi community !

I got some troubles using PDF Viewer widget of mappView. Here is what I would like to do :

I have some production report exported by MappReport that are saved on an external server (NAS). I would like to implement in my MappView application a page for the user where he can navigate through all reports available on the NAS.

For that the PLC send an HTTP request to a web server on the NAS, that return the list of report files available.

The NAS as a virtual host on the web server to redirect in the correponding folder, like this all report files are available using HTTP.

In my mappView application I have a PDF Viewer, for the moment I’ve hardcoded the source to a specific URL for tests. The widget is configure to usePlugin, this is because I need to have Android clients and Windows clients, on the Android clients I got I need this plugin else nothing is display.

So for example, my PLC as an IP address of : 192.168.200.2 so mappView is accessible on :
“http://192.168.200.2:81”

My NAS ip is : 192.168.200.150 and here is an example of url to access PDF :
“http://192.168.200.150/{virtual_host_name}/Production_report_2024_07_23_14_54_55.pdf”

My clients are on same subnet and have network access to PLC and NAS. When I go on my application and check PDF Viewer I got this error :
“PDF.js v2.9.359 (identifiant de compilation : e667c8cbc)
Message : file origin does not match viewer’s”

In PDF.js plugin that is used I see that if origin isn’t the same and the protocol is not “blob:” then an error is throw
image

Did someone have an idea to solve my issue, display PDF stored on external web server to mappView application ?

Regards,
Florent Boissadier

:up:
Just a little up I didn’t see any update

I think the reason behind this is, that the browsers normally check some CORS stuff, so even if the condition would not be there, you might end up not being able to view the PDF since the location is differend, and your browser might block the connection. Just a thought…

Best regrads,
Marcel

2 Likes

Hi Marcel,

Thanks for this. I understand this but when I use a windows computer and disable the plugin parameter of the widget. MappView display correctly the PDF without problem. My problem seems that Android web browser didn’t have internal support of PDF viewers…

Quick solution : Don’t use Android device :joy:

1 Like

Hey Florent,

so you analyzed: It’s not a CORS issue! Thanks for the feedback!

Jup, Apple is the solution :laughing:

Best regards!

1 Like