JavaScript Redirect inside iframe in webview blocked in iOS redirect inside iframe not working,redirect inside iframe,redirect inside

I'm currently working on a web application that is loaded inside an iframe inside a webview in a mobile app. As the user clicks a button, I perform an AJAX request, and once I get a successful response, I need to redirect the user to another page, by modifying window.top.location.href. This works in most situations, but in a certain iOS app, the redirect is not performed in a fair amount of cases.

I've tried to search for information about this, but given the peculiar setup, I haven't really been able to find anything. I don't control the iOS app, only the application running inside the iframe, so it's fairly hard to debug.

When the redirect fails, it does so silently. If I inspect the network traffic of the app, I can see that there's no request being made to the URL I try to redirect to.

My current hypothesis is that the redirect is being blocked as a security measure because it's not a direct result of a user interaction. You click on a button, the request is made, then the redirect happens a second or two later (depending on how long the request takes). I have tried to verify this in two ways:

  1. Tap the screen in random, non-interactable spots while the reuqest is being made. If there is some kind of simple timer that is reset any time you interact with the device, to determine whether or not the redirect should be allowed, then tapping should make the redirect work. As far as I can tell, that is the case, but it's hard to verify that it isn't caused by something else.

  2. Introduce an artificial delay before the redirect. So even if the request is done after 500ms, I wait an additional five seconds before doing the redirect. This should cause the redirect to fail consistently. Doing this also seems to support my hypothesis, but again, it's hard to know if that is the reason.

Has anyone else experienced this issue? If so, is my hypothesis correct, and did you come up with another workaround than adding a "Click to continue" button to actually do the redirect? Is there any documentation on this behavior anywhere?

Answer:1

In JavaScript, defining a classlike (constructor) function method is usually done like this: function Class1() { // ... code ... } Class1.prototype.method1 = function(args) { // ... code ... }; ...

In JavaScript, defining a classlike (constructor) function method is usually done like this: function Class1() { // ... code ... } Class1.prototype.method1 = function(args) { // ... code ... }; ...

  1. using this in prototype javascript
  2. using prototype board
  3. using prototype pcb
  4. using prototype in typescript
  5. using prototype in node.js
  6. using prototype pcb board
  7. using prototype in es6
  8. using prototype js
  9. using prototype in c++
  10. using prototype inheritance in javascript
  11. using prototype angularjs
  12. using prototype in spring
  13. using prototype functions in javascript
  14. using prototype in sentences
  15. using prototype model

I'm started learning JavaScript promises, but I can't understand how apply, for example, Q functions to Node.js callback functions. In similar question is recommended to use Q.denodeify(), but it ...

I'm started learning JavaScript promises, but I can't understand how apply, for example, Q functions to Node.js callback functions. In similar question is recommended to use Q.denodeify(), but it ...

  1. using promises with axios
  2. using promises with react
  3. using promises with jquery ajax
  4. using promises with async await
  5. using promises with fetch
  6. using promises with ajax
  7. using promises with mongoose
  8. using promises with callbacks
  9. using promises with express
  10. using promises with settimeout
  11. using promises with request
  12. using promises with observables
  13. using promises with filereader
  14. using promises with mongodb
  15. using promises with jquery
  16. using promises with dynamodb
  17. using promises with async
  18. using promises with ie11
  19. using promises with node
  20. using promises in javascript

I'm having trouble replacing characters in a string. Here's the code I currently have: var entry_value = document.getElementById("entry_box").value; var length = entry_value.length; for(var l = 0; ...

I'm having trouble replacing characters in a string. Here's the code I currently have: var entry_value = document.getElementById("entry_box").value; var length = entry_value.length; for(var l = 0; ...

  1. replace character string javascript
  2. replace character string python
  3. replace character string in r
  4. replace character string c#
  5. replace character string java
  6. replace character string js
  7. replace character string powershell
  8. replace character string swift
  9. replace character string vba
  10. replace character string typescript
  11. replace character string php
  12. replace character string
  13. replace character string matlab
  14. replace character string bash
  15. replace character string excel
  16. replace character string stata
  17. replace character string sql
  18. replace character string kotlin
  19. replace character string swift 4
  20. replace character string sas

Using angular brings lot of weird style of code. For example I always thought that this <button onclick="myFunction()">Click me</button> style I should not ever use, except when I would ...

Using angular brings lot of weird style of code. For example I always thought that this <button onclick="myFunction()">Click me</button> style I should not ever use, except when I would ...

  1. javascript using function from another file
  2. javascript using function
  3. javascript using function arguments
  4. javascript using function php
  5. javascript using function expression
  6. using javascript function in html
  7. using javascript function in typescript
  8. using javascript function in angular 2
  9. javascript function using parameters
  10. using javascript function in jquery
  11. javascript function using array
  12. using javascript function return value in html
  13. javascript function using ajax
  14. using javascript function in angular 7
  15. javascript function using event
  16. javascript class using function
  17. javascript program using function
  18. javascript object using function
  19. javascript sort using function
  20. javascript using alert function