I am working on checking if string exists on page. And I have some difficulties. I have url that generated by system var url = here it generated it in string format
and its in "string" format. So lets say it has for of "url/my" and "url/yours" I make it to be url by <a href="@url" target="_blank">@text</a>
I need to check if it contains exact word on page in generated url
<script type='text/javascript'>
window.onload = function () {
if (document.body.innerHTML.toString().indexOf('something') > -1) {
alert("It contains 'something'");
}
};
</script>
This is working on the page that was opened, but not on the page of the generated URL. I need to make it work in IF-ELSE statement. Something like
if(url contain word "something")
{
do that
}
So I need somehow pass generated url with href to script and then to if-else statement