You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have ionic/cordova IOS/Android/Electron project that downloads zip, unzips it and shows html/css/js from that zip.
It worked OK while on UIWebView and cordova-plugin-inappbrowser v3.2.0, but migrating to WKWebView and latest inappbrowser (4.0 from github master branch) proved a bit harder than I expected.
After PR #693 and my PR #778 I managed to open local files using file:// in v4 branch, but XHR did not work.
I decided to ditch local files opening with file:// and I implemented local httpd server (using my fork of cordova-httpd), and managed to get XHR to work again BUT found different and very strange bug.
My app relies on using IAB beforeload, loadstart and loadstop events which handle detection if outbond links were pressed in local html files etc. When page opens, and event gets triggered I can check event.url and see on which url the event got triggered.
What does actually happen?
While using latest version of cordova-plugin-inappbrowser url in event.url comes wrong.
Instead of http://127.0.0.1:8888/20612/21018.html I get http://localhost:8080/127.0.0.1:8888/20612/21018.html.
Notice the extra string: localhost:8080/.
Information
Let's say that my local data is downloaded into /Users/{username}/Library/Developer/CoreSimulator/Devices/B0B80D63-64FD-4FBD-879B-92D2204BA713/data/Containers/Data/Application/1625CAAA-AF07-4706-BDA2-DB2D85938AB8/Documents/WebRoot, and that is a web root of local webserver.
So the final file I am about to load is located locally in /Users/{username}/Library/Developer/CoreSimulator/Devices/B0B80D63-64FD-4FBD-879B-92D2204BA713/data/Containers/Data/Application/1625CAAA-AF07-4706-BDA2-DB2D85938AB8/Documents/WebRoot/20612/21018.html
Local web server is started on http://127.0.0.1:8888/
The url passed to IAB for opening is http:/127.0.0.1:8888/20612/21018.html
This works ok, page gets opened. However, when ANY event is triggered, the event.url returned is: http://localhost:8080/127.0.0.1:8888/20612/21018.html
I have 0 (zero) references to localhost:8080 in my code or config.xml.
However, I have found out that after preparing project, this gets generated:
I updated all Cordova tooling to most recent version
I included all the necessary information above
The text was updated successfully, but these errors were encountered:
guycalledseven
changed the title
iOS wrong event.url in IAB events (beforeload, loadstart and loadstop)
iOS wrong event.url in IAB events (beforeload, loadstart and loadstop) when loading local files
Sep 11, 2020
guycalledseven
changed the title
iOS wrong event.url in IAB events (beforeload, loadstart and loadstop) when loading local files
iOS wrong event.url in IAB events (beforeload, loadstart and loadstop)
Sep 11, 2020
Bug Report
Problem
I have ionic/cordova IOS/Android/Electron project that downloads zip, unzips it and shows html/css/js from that zip.
It worked OK while on UIWebView and cordova-plugin-inappbrowser v3.2.0, but migrating to WKWebView and latest inappbrowser (4.0 from github master branch) proved a bit harder than I expected.
After PR #693 and my PR #778 I managed to open local files using
file://
in v4 branch, but XHR did not work.I decided to ditch local files opening with file:// and I implemented local httpd server (using my fork of cordova-httpd), and managed to get XHR to work again BUT found different and very strange bug.
My app relies on using IAB
beforeload
,loadstart
andloadstop
events which handle detection if outbond links were pressed in local html files etc. When page opens, and event gets triggered I can checkevent.url
and see on which url the event got triggered.What does actually happen?
While using latest version of
cordova-plugin-inappbrowser
url inevent.url
comes wrong.Instead of
http://127.0.0.1:8888/20612/21018.html
I gethttp://localhost:8080/127.0.0.1:8888/20612/21018.html
.Notice the extra string:
localhost:8080/
.Information
Let's say that my local data is downloaded into
/Users/{username}/Library/Developer/CoreSimulator/Devices/B0B80D63-64FD-4FBD-879B-92D2204BA713/data/Containers/Data/Application/1625CAAA-AF07-4706-BDA2-DB2D85938AB8/Documents/WebRoot
, and that is a web root of local webserver.So the final file I am about to load is located locally in
/Users/{username}/Library/Developer/CoreSimulator/Devices/B0B80D63-64FD-4FBD-879B-92D2204BA713/data/Containers/Data/Application/1625CAAA-AF07-4706-BDA2-DB2D85938AB8/Documents/WebRoot/20612/21018.html
Local web server is started on
http://127.0.0.1:8888/
The url passed to IAB for opening is
http:/127.0.0.1:8888/20612/21018.html
This works ok, page gets opened. However, when ANY event is triggered, the
event.url
returned is:http://localhost:8080/127.0.0.1:8888/20612/21018.html
I have 0 (zero) references to
localhost:8080
in my code orconfig.xml
.However, I have found out that after preparing project, this gets generated:
platforms/ios/<APPNAME>/config.xml
:platforms/ios/ios.json
:All in all -
allow-navigation
configuration shouldn't have ANY impact onevent.url
.Command or Code
Environment, Platform, Device
iOS 13.7
Version information
Checklist
The text was updated successfully, but these errors were encountered: