I want to get the value of a particular Javascript variable hard-coded in a html page. Visit the test-case with the following instructions:
- Go to the website : http://www.headphonezone.in/
- Open console
- Type :
Shopify.theme
- Output is :
Object {name: "Retina", id: 8528293, theme_store_id: 601, role: "main"}
- Type :
Shopify.theme.theme_store_id
- Output is : 601
The above response comes from the script given below, which is present in all the Shopify stores.
<script>
//<![CDATA[
var Shopify = Shopify || {};
Shopify.shop = "headphone-zone.myshopify.com";
Shopify.theme = {"name":"Retina","id":8528293,"theme_store_id":601,"role":"main"};
//]]>
</script>
How to write a java code to get the value of Shopify.theme.theme_store_id
field and store it?