/    Sign up×
Community /Pin to ProfileBookmark

Incognito redirect

Is there a way to make a redirect like:

location=<url>

…without changing the URL in the address bar?

Thanks in advance and kind regards

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@aj_nscFeb 20.2012 — Not allowed (or do-able). Security risk is too great. Think about it - what if everyone could change the URL in the address bar to something different that the page the user is actually seeing? You might think you're on paypal but you could actually be on an attacker's site.

What's the goal?
Copy linkTweet thisAlerts:
@arvgtaauthorFeb 20.2012 — Ok, thanks very much!

Then I can forget that approach...

You can see what I'm trying to do here: http://4nf.org/thanks/

(see script: http://4nf.org/n.js)

Such an "incognito redirect" might have been superior to the approach I'm using now...
Copy linkTweet thisAlerts:
@rnd_meFeb 21.2012 — Is there a way to make a redirect like:

location=<url>

...without changing the URL in the address bar?


Thanks in advance and kind regards[/QUOTE]


sure. just use ajax to change the page without refreshing.

this is not hacking, it's good UX and the way more and more sites are being built.

or, you can send them to the new site and use history.pushState() to change the visible URL in the address bar back without reloading the page again.
Copy linkTweet thisAlerts:
@arvgtaauthorFeb 24.2012 — Hi rnd_me,

(sorry for the late reply - didn't see your post)

I would of thought, judging by internet research, that history.pushState or the older location.hash are viable.

Have tried to implement history.pushState on a modern browser against:

http://4nf.org/thanks/

(in http://4nf.org/n.js - I'll set my approach live now for evaluation)

It didn't work because control seemed to be completely handed over to the redirected page. It seemed that the browser didn't even get to interpret pushState. I followed the directions for setting up pushState rather carefully... (basically one could see the redirected URL in the address bar)

Do you think it should work nevertheless? Have you any example of pushState in action somewhere?


Thanks a million and kind regards
Copy linkTweet thisAlerts:
@arvgtaauthorFeb 24.2012 — ...or do I have to enter pushState on the redirected page

(no problem - I'm in control of that, too)

At the moment it seems that pushState is being issued, but when the redirect kicks in, the URL in the address bar is being overridden?
Copy linkTweet thisAlerts:
@arvgtaauthorFeb 24.2012 — I think I read somewhere that pushState only works on the same domain?

If so, it would be useless for my purposes (even though I control all domains)

(same with location.hash)

Does anyone know?
Copy linkTweet thisAlerts:
@rnd_meFeb 24.2012 — I think I read somewhere that pushState only works on the same domain?

If so, it would be useless for my purposes (even though I control all domains)

(same with location.hash)

Does anyone know?[/QUOTE]


yes, same-domain only.

i'm not sure what you're trying to accomplish, but if you control both domains, there's no reason you can't mash them up together on the server or the client.
×

Success!

Help @arvgta spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...