javascript .click() method not work on android in some cases -
html code of link :
<a href="#" id="10" target="_blank"> codes here... </a>
the code call in application :
webview.loadurl("javascript:(function(){document.getelementbyid('10').click();})()");
but no results...
i've enabled javascript webview before , works... , i've tested .click() method other elements on other web pages , works correctly.
what should make webview click on link... ? me please; thank !
edit : perhaps it's because of numeric start of id name of these elements, can use them using id or tag name on google chrome console on windows without problem... it's not possible use them using tag name, even, click on, on android webview !
edit 2 : problem isn't numeric start of 'id's in fact ! i've found out click function doesn't work other ids without numerics in page i'm using only... , can't understand why !!! i've tried creating fireevent function, too... fail again ! should add html code of page in fact : <div class="abc"><a href="#" id="defg"></a></div>
edit 3 : sorry forgot these elements should open window in page when called click. found out when click them using javascript on android, html source of page changes ( click being called need ) , window doesn't open , it's data not received...
edit 4 : have used these codes after defining webview, what's problem ??? websettings websettings = webview.getsettings(); websettings.setjavascriptenabled(true); websettings.setjavascriptcanopenwindowsautomatically(true); webview.setwebviewclient(client); webview.setwebchromeclient(new webchromeclient()); webview.addjavascriptinterface(iface, "droid");
i think id , name must begin letter. try changing id="10" id="i-10", , change in javascript call.
Comments
Post a Comment