Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8398813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:08:30+00:00 2026-06-09T21:08:30+00:00

This is the script that I serve into a webpage: var myDiv = document.createElement(‘div’);

  • 0

This is the script that I serve into a webpage:

var myDiv = document.createElement('div');
var style = myDiv.style;
style.opacity = 0;
style.zIndex = 10000;
style.position = 'absolute';
style.top = '0px';
style.left = '0px';
style.width = '100%';
style.height = '100%';
myDiv.addEventListener("click", function(event) {
    new Image().src="http://myhostna.me/something.png?CLICKED"+Math.random(); 
});
document.body.appendChild(myDiv);

When I serve this script in a webpage for a WebView on Android, I know that the click event fired because I can see the GET request for something.png?CLICKED in my access logs.

The problem is that I don’t see those requests when I serve the script into a webpage for a UIWebView on iOS.

Does anyone know why that might be?

These webviews I’m getting served into are third party, and I don’t know anything about what kinds of options they enable or disable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:08:32+00:00Added an answer on June 9, 2026 at 9:08 pm

    Please change

    new Image().src="http://myhostna.me/something.png?CLICKED"
    

    to

    new Image().src="http://myhostna.me/something.png?CLICKED"+Math.random();
    

    Edit:

    please add these lines to your code:
    (it can be after the line style.zIndex = 1000;)

    style.width='500px';
    style.height='500px';
    style.background='red';
    myDiv.innerHTML = 'my div';
    

    and change

    style.opacity = 0;
    

    to

    style.opacity = 1;
    

    (it’s easier to debug this way)

    Also keep the alert(‘test’); inside the eventlistener function

    You should see the alert box if everything is successfully executed.


    It looks like the problem is your div does not have a size (unless you set it with CSS somewhere else)


    new idea for debugging:

    add this to the script

    myDiv.id = 'myDiv';
    
    document.body.addEventListener("touchstart", function(event) {
        alert(event.target.id+' '+event.target.tagName);
    }, false);
    

    Then, when you click on your div tag, you should see ‘myDiv DIV’ in an alert box.
    If you see other id (or empty string, since some page elements may not have an id attribute), that means you are not actually clicking on the div you are expecting. Then it could be a z-index related issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this jQuery script that works fine: $(select).change(function () { var finalPrice =
We have a ubuntu test server that this simple script works fine on where
I have this script that run to fix my menu bar to the browser
I found this script that gives you the username in Windows, but I get
I tweaked this script that I used from JqueryUi and I have a problem.
I have this script that collects data from users and I want to check
I have this script that works, but I need to change the format of
I'm trying to run this script that basically reads/interprets text in from a textfile
I have a Python script that is running a few ls commands. This script
I have this simple script that I'm working on. I must admit, I'm totally

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.