You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "rolinger (via GitHub)" <gi...@apache.org> on 2023/09/21 21:47:03 UTC

[GitHub] [cordova-ios] rolinger opened a new issue, #1373: cordova ios not injecting referrerpolicy into iframe url calls

rolinger opened a new issue, #1373:
URL: https://github.com/apache/cordova-ios/issues/1373

   I don't know if this is a bug or if I am doing it wrong but my app loads an iframe and the call to the url is not adding the `origin` or `referrer` attributes to the header.
   
   In my iFrame I have added:
   
   `<iframe referrerpolicy="origin" id="logframe" ng-src="{{logItem.url}}" style="width:100%;height:100%;"> </iframe>`
   
   That didn't work, and then I added the following to my main index.html page:
   ```
       <meta name="referrer" content="origin">
       <meta http-equiv="Referrer-Policy" content="origin">
   ```
   And that did not work either.  Am I doing something wrong, is this a bug or is it simply just not possible?  According to the web specs on WkWebView it indicates the attribute should be allowed.


-- 
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: issues-unsubscribe@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] rolinger commented on issue #1373: cordova ios not injecting referrerpolicy into iframe url calls

Posted by "rolinger (via GitHub)" <gi...@apache.org>.
rolinger commented on issue #1373:
URL: https://github.com/apache/cordova-ios/issues/1373#issuecomment-1731351053

   @breautek - thanks for the clarification.  The `referrerpolicy="origin"` does not work, as stated in my OP.  The next thing I am going to try to do an XHR load of the document where I can control the CORS and then load that into `<iframe srcdoc="(XHR content)" ...>`


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] cordova ios not injecting referrerpolicy into iframe url calls [cordova-ios]

Posted by "erisu (via GitHub)" <gi...@apache.org>.
erisu closed issue #1373: cordova ios not injecting referrerpolicy into iframe url calls
URL: https://github.com/apache/cordova-ios/issues/1373


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] rolinger commented on issue #1373: cordova ios not injecting referrerpolicy into iframe url calls

Posted by "rolinger (via GitHub)" <gi...@apache.org>.
rolinger commented on issue #1373:
URL: https://github.com/apache/cordova-ios/issues/1373#issuecomment-1732367159

   For anyone who comes across this issue, I found a solution that side loads a document into an iFrame using an XHR (ie: `$http.get()`) to pass the needed CORS values to my backend server.    This CORS request sends the `origin` (which my server requires) and successfully retrieves the html document:
   ```
   $http.get(url)
   .then(function(response) {
       $scope.urlHTML = $sce.trustAsHtml(response.data) ;
   }) '
   
   ```
   Then I am able to bind the html document to the iFrame:
   
   `<iframe ng-attr-srcdoc="{{urlHTML}}"></iframe>`
   
   A full SO is listed here:  https://stackoverflow.com/questions/77160980/angularjs-http-document-load-into-an-iframe


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] rolinger commented on issue #1373: cordova ios not injecting referrerpolicy into iframe url calls

Posted by "rolinger (via GitHub)" <gi...@apache.org>.
rolinger commented on issue #1373:
URL: https://github.com/apache/cordova-ios/issues/1373#issuecomment-1730484837

   
   @breautek  I am a bit confused by your response.   Could you clarify please?  Are you saying the WKWebView does send the header if the browser is making a CORS request...so I am interpreting this to mean that an iFrame is not making a CORS request?  Is there any method to get the iFrame to send origin or referrer then?  If WKWebView doesn't support `referrerpolicy` directly in the iframe element then I am assuming there is no method to get an iframe to send origin or referrer....true?


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] breautek commented on issue #1373: cordova ios not injecting referrerpolicy into iframe url calls

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1373:
URL: https://github.com/apache/cordova-ios/issues/1373#issuecomment-1731341364

   > Could you clarify please? Are you saying the WKWebView does send the header if the browser is making a CORS request...so I am interpreting this to mean that an iFrame is not making a CORS request? 
   
   You're understanding is correct, but honestly `iframe` sometimes have behaviour than other kinds of request, so with iframes specifically I don't know how that is handled. But generally speaking (like for image requests, XHR/fetch requests, or other resource requests will only send the `origin` header if the browser ends up making a CORS request. Some other browsers may always send the `origin` header but you can't really rely on this behaviour, and the WKWebView is one webview that I know will only send the header if it's actually making a CORS request.
   
   > Is there any method to get the iFrame to send origin or referrer then?
   
   There is a [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) attribute that tells the browser to make a CORS request for that resource, but `iframe` doesn't appear to be in the list of supported tags, so this leads me to believe that because an iframe acts as a sub-document it doesn't become a CORS request, ever. I do know there are other iframe policies that can be set 
   
   > If WKWebView doesn't support referrerpolicy directly in the iframe element then I am assuming there is no method to get an iframe to send origin or referrer....true?
   
   Here's something you can try... the iframe tag/object appears to have a referrer property itself, instead of trying to set it via the meta tag. That's [supposedly](https://caniuse.com/mdn-html_elements_iframe_referrerpolicy) supported on iOS 13+, but it's important to understand that `Safari on iOS` represents the Safari browser app, and not `WKWebView` and they are not necessarily the same. See the [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#referrerpolicy) docs on the `referrerpolicy` attribute.
   
   Based on your given config I think the equivilant would be:
   
   ```
   <iframe src="..." referrerpolicy="origin" />
   ```
   
   If that works, you'll probably want to bump your minimum supported iOS to 13, as Cordova defaults to 11.


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] cordova ios not injecting referrerpolicy into iframe url calls [cordova-ios]

Posted by "erisu (via GitHub)" <gi...@apache.org>.
erisu commented on issue #1373:
URL: https://github.com/apache/cordova-ios/issues/1373#issuecomment-1985706518

   Closing out this issue as there is nothing actionable. Appears to be a missing web feature. Also the original OP provided a solution.


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] breautek commented on issue #1373: cordova ios not injecting referrerpolicy into iframe url calls

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1373:
URL: https://github.com/apache/cordova-ios/issues/1373#issuecomment-1731370622

   >  The referrerpolicy="origin" does not work, 
   
   Ah yah, I missed that, my apologies.
   
   > The next thing I am going to try to do an XHR load of the document where I can control the CORS and then load that into <iframe srcdoc="(XHR content)" ...>
   
   Not quite sure what kind of kind of limitations that may impose but XHR if it's going to an origin other than the cordova document, then it should trigger a CORS request, so I'd suspect that to work in terms of having the `origin` header sent.


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-ios] breautek commented on issue #1373: cordova ios not injecting referrerpolicy into iframe url calls

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1373:
URL: https://github.com/apache/cordova-ios/issues/1373#issuecomment-1730350756

   `origin` request header is part of the `CORS` protocol. The CORS spec leaves it up to the user agent to add it to request headers or not, the only requirement is that the header must be sent if the user agent is making a "CORS" request, and the WKWebView does just that.
   
   As for the Referrer-Policy, there's a open [feature request](https://bugs.webkit.org/show_bug.cgi?id=206521) for wkwebview to support it, so I'm guessing that's not something WKWebView actually supports?


-- 
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: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org