JSFiddle - React, Tailwind, and code Playground

by Amin Kodaganur

HTML

<!DOCTYPE html>
<html>
    <head>
        <title>Page Title</title>
    </head>
    <body>
        <h1>Market-smith widget Testing</h1>
        <p>This is something!!.</p>

        <div id ="msiDiv"></div>
        
       
    </body>
</html>

JavaScript

function generateMSIToken(userAgent, authToken, uid, userState, userType, startDate, endDate) {  
	var src =  "https://marketsmithindia.com/mstool/fyers/generateMSIToken?userAgent="+userAgent+"&authToken="+authToken+"&uid="+uid+"&userState="+userState+"&userType="+userType+"&startDate="+startDate+"&endDate="+endDate;  

	var msiIframe = document.getElementById("msiIframe");  

	if(msiIframe == null || msiIframe == ""){  
		msiIframe = document.createElement("iframe");  
		msiIframe.id = "msiIframe";  
		msiIframe.src =  "https://marketsmithindia.com/mstool/landing.jsp#/"; 
    console.log(src)
		// document.body.appendChild(msiIframe);  
		// var msilDiv = document.createElement("div"); 
		document.getElementById("msiDiv").appendChild(msiIframe);
	} else {  
		if(src != msiIframe.src) {  
			msiIframe.src =  src;  
		}  
	}  
};

function deleteMSIToken(){  
	var src = "https://marketsmithindia.com/mstool/fyers/deleteMSIToken";  
	var msiIframe = document.getElementById("msiIframe");  
	if(msiIframe == null || msiIframe == ""){  
		msiIframe = document.createElement("iframe");  
		msiIframe.id = "msiIframe";  
		msiIframe.src =  src;  
		document.body.appendChild(msiIframe);  
	} else {  
		if(src != msiIframe.src){  
			msiIframe.src =  src; 
		} 
	} 
}; 

function openMsiUrl(tabType, symbol=""){
	try {
		var msiUrl = "";
		// Symbol Evaluation Tab
		if (tabType === 1) {
			if (symbol == "" || symbol == null) {
				console.log("openMsiUrl : Invalid symbol : ", tabType, symbol);
				return;
			}
			msiUrl = "https://marketsmithindia.com/mstool/evaluation.jsp#/symbol/" + symbol;
		}

		// IdeaList Tab
		else if (tabType === 2) {
			msiUrl = "https://marketsmithindia.com/mstool/ideaLists.jsp#/";
		}

		// Market Outlook
		else if (tabType === 3) {
			msiUrl = "https://marketsmithindia.com/mstool/marketOutlook.jsp#/";
		}

		// Model Portfolio
		else if (tabType === 4) {
			msiUrl = "https://marketsmithindia.com/mstool/modelPortfolio.jsp#/";
		}

		else...