Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't redirect to remote server #1889

Open
amitaibu opened this issue Jan 9, 2024 · 2 comments · May be fixed by #1891
Open

Can't redirect to remote server #1889

amitaibu opened this issue Jan 9, 2024 · 2 comments · May be fixed by #1891
Assignees

Comments

@amitaibu
Copy link
Collaborator

amitaibu commented Jan 9, 2024

I was trying to see if I can redirect to a controller, and add a hash. So I tried this function:

redirectToUrl "https://github.com/digitallyinduced/ihp?query=1#hash=2"

But this results with an error - likely because we are trying to Ajax it.

image

@amitaibu amitaibu self-assigned this Jan 10, 2024
@mpscholten
Copy link
Member

You can use formForWithoutJavascript (https://ihp.digitallyinduced.com/Guide/form.html#disable-form-submission-via-javascript) to workaround this issue (assuming you have a form)

@amitaibu
Copy link
Collaborator Author

I think that won't work in all cases. Silly example:

A user has to enter a URL in the field, and when submitted, we will redirect there. Before submit, we still don't know if there's CORS enabled on that URL.

What this PR does is try to fetch it via JS. If it fails, instead of returning an error, it does a full page refresh for the redirect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants