WordPress: Javascript redirect issue using window.location when called from home page

So, I have a plugin that redirects users, using jQuery/Javascript, to a specified page as follows:

window.location.href = window.location.hostname + '/index.php/searchresults-gw/'

When the plugin is referenced from any page other than the home page, 192.1.0.2/pagename/ for example, then the user is correctly redirected to 192.1.0.2/index.php/searchresults-gw/.

Read More

But when the same plugin is referenced from the home page (192.1.0.2), the url tries to resolve to 192.1.0.2/192.1.0.2/index.php/searchresults-gw/

What am I overlooking here?

Related posts

Leave a Reply

1 comment