Search posts, tags, users, and pages
Kindly upload the code for opening button in same tab with proper navigation of respective page of button selected
Thank you for your comment! It is possible to use JavaScript to open a link in the same tab by following the instructions mentioned in the blog post, excluding the '_blank' portion. For example, it would be window.open('workingunittests.com');
Yes Matt Dean I have tried this but due to window.open it's opening in new tab not in the same tab. Kindly provide some other solution to open link in same tab.
Sweta Hey there! After a little research, this is actually solvable by instead of using '_blank', use '_self' and you should be good to go!
Sweta Something that I find useful for these sorts of things is to search in your search engine the language you are working with (in this case, JavaScript) followed by your intended action. It takes a little tinkering to learn what keywords to use all the time, so expect a little practice. I ended up searching for "js open link in same tab" which helped me solve the issue
Matt Dean I have tried using '_self', window.location.replace, window.location.href, window.location.assign all did not work for opening the link in the same tab. '_self' is opening current page what is opened in website but not the respective page of the link after clicking on the link. Kindly provide some other solution.
Sweta I believe this topic may not currently align with the focus of this blog (I suggest conducting research to determine if others have attempted this with the same JS framework you are using). Additionally, there are multiple factors that could impact the desired functionality you are seeking. It would be advisable to incorporate console logs and debugger statements in order to gain a thorough understanding of any deficiencies, whether they may involve errors or incorrect logic.
Matt Dean thanks a lot for your immediate response. will check the errors in console since it's showing Typeerror: cannot read properties of null for navigation.