javascript - How do I select a specific json string from a url for displaying in a webview? -
i getting json string parameter javascript files follows :
http://local/action/?action=loadfile¶ms=%7b%22filechart%22%3a%22url%22%2c%22item%22%3a%7b%22docid%22%3a%2270078903%22%2c%22headline%22%3a%22alert%253a%2520aapl%253a%2520qa%2520test%22%2c%22primarytickers%22%3a%22aapl.o%22%2c%22arrivaldate%22%3a%222015-04-29t08%3a04%3a40z%22%2c%22filetype%22%3a%22url%22%2c%22secondaryfiletype%22%3a%22pdf%22%2c%22secondaryfileextension%22%3a%22pdf%22%2c%22curdate%22%3a1435589346483%2c%22pages%22%3a8%2c%22url%22%3a%22https%253a%252f%252fuat.citivelocity.com%252frendition%252feppublic%252fdocumentservice%252fdxnlcl9pzd0mywn0aw9upxzpzxc%252fzmlszv9uyw1lpvztnkoucgrm%22%2c%22contributor%22%3a%22citi%20-%20linkback%20test%22%7d%7d&requesttype=get×tamp=1435589346484
i want display url part of above url, such can decode https given link , display required link in webview loadurl. in case of above link it's : https://uat.citvelocity.com ..etc , current idea got searching online :
webview.loadurl("javascript:(function() { "| "document.getelementbytagname('url')[0].style.display="+";"+"})()"); } });
but doesn't work expected. doing wrong? ideas ?
since string json, it's idea parse json object can use objects properties whatever want.
var decoded = decodeuricomponent('http://local/action/?action=loadfile¶ms=%7b%22filechart%22%3a%22url%22%2c%22item%22%3a%7b%22docid%22%3a%2270078903%22%2c%22headline%22%3a%22alert%253a%2520aapl%253a%2520qa%2520test%22%2c%22primarytickers%22%3a%22aapl.o%22%2c%22arrivaldate%22%3a%222015-04-29t08%3a04%3a40z%22%2c%22filetype%22%3a%22url%22%2c%22secondaryfiletype%22%3a%22pdf%22%2c%22secondaryfileextension%22%3a%22pdf%22%2c%22curdate%22%3a1435589346483%2c%22pages%22%3a8%2c%22url%22%3a%22https%253a%252f%252fuat.citivelocity.com%252frendition%252feppublic%252fdocumentservice%252fdxnlcl9pzd0mywn0aw9upxzpzxc%252fzmlszv9uyw1lpvztnkoucgrm%22%2c%22contributor%22%3a%22citi%20-%20linkback%20test%22%7d%7d&requesttype=get×tamp=1435589346484'), json = json.parse(decoded.slice(decoded.indexof('¶ms=') + 8, decoded.indexof('&requesttype'))), url = decodeuricomponent(json.item.url);
Comments
Post a Comment