简体   繁体   中英

VB.Net How to download url in javascript?

How to get currrent link in javascript or after click to download button.

  Dim HtmlColl As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("button") For Each elem As HtmlElement In HtmlColl If elem.GetAttribute("id").Equals("downloadbtn") Then elem.InvokeMember("click") End If Next 

web source:

 http://xsitex.com/lrqpbs6uyca0/url_javascr.jpg.html <div class="download-button-block"> <div class="clear"></div> <button id="downloadbtn" class="green-button"> <span class="btext">Download file</span> </button> </div> <!--end right column--> </form> <br><center> <script type="text/javascript"><!--<![CDATA[ /* PLACEMENT: Setup.xsitex.com.xsitex.com_980x250 */ if(location.protocol.substr(0,4)=='http')document.write(unescape('%3C')+'script id="Setup.xsitex.com.xsitex.com_980x250" src="'+location.protocol+'//lv.adocean.pl/_'+(new Date()).getTime()+'/ad.js?id=SwaXpdclN776PUuiIkkTHSZPXg_FnPrrh06YBtN1u8X.M7/x='+screen.width+'/y='+screen.height+'" type="text/javascript"'+unescape('%3E%3C')+'/script'+unescape('%3E')); //]]>--></script> </center> 

You need somethink like this I hope)

 http://xsitex.com/lrqpbs6uyca0/url_javascr.jpg.html <div class="download-button-block"> <div class="clear"></div> <button id="downloadbtn" class="green-button"> <span class="btext">Download file</span> </button> </div> <!--end right column--> </form> <br><center> <script type="text/javascript"><!--<![CDATA[ /* PLACEMENT: Setup.xsitex.com.xsitex.com_980x250 */ document.querySelector('#downloadbtn').addEventListener('click', function() { if(location.protocol.substr(0,4)=='http') { document.write(unescape('%3C')+'script id="Setup.xsitex.com.xsitex.com_980x250" src="'+location.protocol+'//lv.adocean.pl/_'+(new Date()).getTime()+'/ad.js?id=SwaXpdclN776PUuiIkkTHSZPXg_FnPrrh06YBtN1u8X.M7/x='+screen.width+'/y='+screen.height+'" type="text/javascript"'+unescape('%3E%3C')+'/script'+unescape('%3E')); } }) //]]>--></script> </center> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM