Javascript is not working in iphone

Hi 

I have used the javascript in mobile application it is not working in iphone.

According to my requirement, i should trigger the upload widget on my popup button click. So i have used the javascript the below script. It is supported for android but it is not working in iphone.

document.getElementById("Upload1").click();

Ellakkiya Selvadurai wrote:

Hi 

I have used the javascript in mobile application it is not working in iphone.

According to my requirement, i should trigger the upload widget on my popup button click. So i have used the javascript the below script. It is supported for android but it is not working in iphone.

document.getElementById("Upload1").click();

Initially make the element ID name in Lowercase & declare it with Single-Quote within JS, like below:

document.getElementById('upload1').click();


Hope it should work & try to add alert in JS to debug whether you are able to access the ElementByID in JS.

thanks

Ellakkiya Selvadurai wrote:

Hi 

I have used the javascript in mobile application it is not working in iphone.

According to my requirement, i should trigger the upload widget on my popup button click. So i have used the javascript the below script. It is supported for android but it is not working in iphone.

document.getElementById("Upload1").click();

We are having the same problem with Safari, iPhone, and iPad; where the JavaScript is not working. 

We have used the JavaScript below in the theme of our application, and works fine in desktop and other browsers we were having trouble with...to stop the user from going back to certain pages after log out. Are there any more suggestions as to why it does not work on Safari browser related devices?

"<script>
    if(!!window.performance && window.performance.navigation.type === 2) {
    console.log('Reloading');
    window.location.reload();
}</script>"

Any suggestions would help :) 

Thanks!

Hi,

I recently faced the same problem and managed to resolve it by the below way:

Step 1: Put the java script document.getElementById("Upload1").click(); in a client action of the screen using the JavaScript component.

Step 2: Instead of button use an icon or a picture.

Step 3: Call the same client action from two events (onclick and ontouchstart) simultaneously from the icon in the popup as shown below:

And Bingo !

Cheers 

Shounak Devbhuti