[TIMOB-26768] Android : Beforeload event not working with PDF links on Android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-03-20T18:04:05.000+0000 |
Affected Version/s | Release 7.5.0 |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Aminul Islam |
Assignee | Gary Mathews |
Created | 2019-01-25T18:01:42.000+0000 |
Updated | 2019-03-20T18:04:09.000+0000 |
Description
Hello,
We have in our application a webview which is loading some links that redirect the user to some PDF files. We know that the Android browser has some issues with PDFs and as a workaround, we use the beforeload event to catch the URL and open the PDFs using other means.
The problem that we see is that the event is only being triggered using an emulator. If we switch to a physical device (we tried on a Pixel 1 and on a Galxy S9) the event is not triggered but ONLY with the links that redirect the user to a PDF. If the link sends the user to a regular html file it works as expected.
Test Code:
$.index.open();
function init(){
var webUrl = '<html><head></head><body><a href="https://www.apple.com/support/products/pdf/applecare_ipod_t_and_c_11182003.pdf">Open PDF
</a><br><a href="https://www.google.com">Open regular url</a></body></html>';
$.webView.html = webUrl;
}
init();
$.webView.addEventListener('beforeload', function(_evt){
alert(_evt.url);
});
Test Environemnt :
Operating System
Name = Mac OS X
Version = 10.13.6
Architecture = 64bit
# CPUs = 4
Memory = 8589934592
Node.js
Node.js Version = 10.14.1
npm Version = 6.4.1
Titanium CLI
CLI Version = 5.1.1
Titanium SDK
SDK Version = 7.5.0.GA
SDK Path = /Users/user/Library/Application Support/Titanium/mobilesdk/osx/7.5.0.GA
Target Platform = android
Please take a look on attached screenshot.
Attachments
File | Date | Size |
---|---|---|
Screenshot_20190125-231435.jpg | 2019-01-25T18:01:38.000+0000 | 54011 |
Screenshot_20190125-231442.jpg | 2019-01-25T18:01:39.000+0000 | 75896 |
Since
7.5.0
theonlink
event is available. They can catch PDF links like so: