wizLocation.url Not Working with Anchors

…trying hard to contain my frustration…I’ve been hanging on hacking my way through wixCode to keep from migrating my website to a new platform, but this may be the straw that breaks the camel’s back…

Here’s a URL on my site :
https://www.wizely.us/login-page#id_token= BLAH

Here’s some code :
let url = wixLocation.url;
console.log(“URL”,url);

Expected response :
URL https://www.wizely.us/login-page#id_token=BLAH

Actual response :
URL https://www.wizely.us/login-page

This broke recently.

What’s the fix?

1 Like
wixLocation.to('/login-page?param=BLAH');
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(function() {
    if (wixLocation.query.param === 'BLAH') {
    wixWindow.scrollTo('anchor1');
    }
}

Sorry - but I think you totally missed the point.

The URL doesn’t contain ‘?’ - it contains ‘#’.

Supposedly, wixLocation.url should provide the entire URL including the portion after the ‘#’.

Instead, wixLocation.url only returns the portion of the url before the ‘#’.

@james83926 This is a different approach. Link to the page using the first snippet, place the second snippet in your login page.

@skmedia Right, I get it - but you’re answering a question I didn’t ask…

I’m not in control of the webpage that generates the first link.

It’s a fairly standard oauth2 convention to use # instead of ? on re-directs.

Am I correct to assume that wix no longer supports this?

@james83926 Dang, sorry. Sleep deprivation is getting to me…I mixed up your question with someone else’s. If you get the path does it still fail to fetch the hash?

@skmedia Yes. There appears to be no way to fetch anything after the # anymore…

@james83926 How do you navigate to this page? When I go to My Wizely and click login it takes me to a separate page.