Iframe doesn't load local file url

Hi
I want that iframe load and play a mp3 file from local file system. for example: file:///C:/w1.mp3.
This is easily done in browser.
I don’t want to use ignition gateway as a file server because of traffic load of server and instead I want put my file in each client PCs.
Is there any way to force iframe open amd play sound file from local file system?

I don’t think the Iframe can connect to the local client’s file system for security reasons.

I’m not sure if there is going to be a way to do this other than maybe WebDev on the gateway level or hosting it in a different central location

Please describe how you are doing this "easily". Can you construct a static web page (not on localhost) example that successfully embeds a localhost iframe? (I'm betting not.)

Yes I can access.
What I mean is if I put static file url from client local drive the browser can access it but the iframe can’t.

The browser level is going to have a different level of access since its still an application running locally on that computer. I can’t seem to find it right now, but I remember seeing a thread saying that because of security reasons that iframe and other components can’t access local client files directly and would have to be uploaded or served from the gateway.

That's not what I'm suggesting you try. Put up a static webpage somewhere (not localhost) with an iframe like you wish, pointing at localhost. It won't work because it is a huge security violation, letting a website get at files in the visitor's hard drive. Candyland for crackers to exfiltrate private data. This will demonstrate that it isn't an Ignition issue, it is a security restriction on all websites.

It can be done cross-domain when the site in the iframe gives permission in a CORS policy. There's no way for your local filesystem to supply a CORS policy, and it would be crazy dangerous to do so.

The only way to make such a thing possible is within a custom Ignition desktop app. Which will have to be strictly audited to only permit legitimate Perspective pages to access the local content. Difficult, so don't hold your breath. Note that the mobile apps don't offer any way to get at the mobile device's local content, either. Just carefully moderated access to select input devices.

2 Likes

Bottom line: if you need a true app-like environment, with local filesystem access, you need to use the Vision module. For the foreseeable future.

2 Likes

Thanks. I completely got the idea.