Web App iframe

Gabri2 years ago

hello, i'm developing a hybrid app with ionic react to use on ios and i wanna embed an iframe into it for the traccar web app, i created my token and am using it in the url. The server is deployed to my website. When i test the app on my local computer in the browser all works as expected, but when i deploy it to my iphone i always get redirected to the login page. Any suggestions? Thank you!

iframe:

<iframe
        title='traccar'
        src='https://mysite.com/?token=myaccesstoken'
      />

error:

[Error] Failed to load resource: the server responded with a status of 404 (Not Found) https://mysite.com/api/session
Anton Tananaev2 years ago

In modern browsers cookies don't work properly in iframe, so that's why you have this issue.

Anton Tananaev2 years ago

This seems to be the relevant information:

https://stackoverflow.com/a/45095345/2548565

Rodrik2 years ago

Hi Gabri,

Which page and how are you embedding the iFrame? I have ip cam want to add on map page
I assume need too add also js lines too, to link to specific user.

Thank you

Gabri2 years ago

@Anton thanks i'll check it out!

@Rodrik i'm just using the iframe code i posted in my first message, i guess to link users you'd need different access tokens that you create in Settings/Preferences. the mysite.com is just where you have your webapp, so for example if you bought a subscription here that would be server.traccar.org.

See permission Ionic for redirect URLS.