dylanfpaul opened a new issue, #1064:
URL: https://github.com/apache/cordova-plugin-inappbrowser/issues/1064

   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   When I am using a beforeload event listener, passing a url to the callback 
should load that URL as expected.
   
   
   ### What does actually happen?
   cordova-plugin-inapp browser fails to load the url and instead throws an 
error:
   
![image](https://github.com/user-attachments/assets/3d28b24c-1363-40f1-a052-cae4cb87c81f)
   (URL blacked out)
   
   
   ## Information
   What is significant here is that this request is a **302 redirect**. I 
believe that  thismay be the catalyst for why this error is popping up but I am 
not sure if inapp-browser's event listener just straight up can't handle 
"redirect" urls, or if I am doing something wrong.
   
   Here is some info on the requested URL when it is made successfully (without 
the beforeload handler and without the error being thrown, notice how it is has 
a status of "302 Found"). How this works is that the "Request URL" is the 
original URL being requested, and the "Location" response header is the new URL 
that the client should be redirected too:
   ![image 
(1)](https://github.com/user-attachments/assets/d8fe32c3-f014-4179-b843-952b00e88309)
   
   
   
   
   ### Command or Code
   `inAppBrowserRef.addEventListener('beforeload', (params, callback) => {
                     if(params.url.match(".pdf")){
                        console.log('MATCH PDF');
                        window.open(params.url, '_system');
                     } else {
                        console.log('DEFAULT HANDLING');
                        // THIS IS WHERE THE ERROR OCCURS
                        callback(params.url);
                      }
   });`
   
   
   
   ### Environment, Platform, Device
   - MacBook Pro Sonoma 14.4.1
   - Xcode 15.3 iPhone 15 Pro Simulator
   
   
   
   ### Version information
   Cordova: Cordova 11, cordova-ios@6, cordova-plugin-inappbrowser v6
   
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [ ] I updated all Cordova tooling to most recent version (not possible due 
to quirks with Node and other unmaintained plugins)
   - [x] I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to