Reload web page in GWT - javascript

After a user logged and press my page url in this page if user press confirm button i want to relaod my page not the home page
Window.alert(ConstantesMessage.MESSAGE_MSG004);
eventBus.goToMyPage();
Window.Location.reload();
this solution work but it's reload the home page not my page

A GWT application is a single page application. So if you reload the web page you get your start page, unless you use the history tokens. See http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsHistory.html When you have a history token the page is still reloaded, but based on the history token you can open the page you want to show. I guess you don't have the history token set, so you'll get your home page.
As an extra thought. It looks like you built the login in GWT. A better solution is to provide a separate login page. And when the user is successfully logged in then open the application.

Related

Redirect page without Internet in React

How can I do, if there is no Internet, the website must go to some redirecting link?
For example, the Instagram page. If I turn off wifi, Instagram redirects me to this page.
Is that possible with react-router? Or What do I have to research?

How can I redirect to multiple fake websites to fill user's history?

I have to do something similar to how this works when you press the "quick exit" button https://www.nationaldahelpline.org.uk/
Basically, when you press that button a new tab with Google will open and the initial website will be redirected through a bunch of fake websites so it goes down in user's history.
I solved opening a new tab by using window.open. Then I tried to do some fake redirects with window.location.replace in a loop but after the first redirect it's a whole new page so my code is lost...
The backend is in .NET, but I'm not sure if this should be done from frontend or from backend, or a combination of both.
I really don't know how I could achieve this...any help would be appreciated, thanks!
It's not the base site that's redirecting, it's the webserver itself that's listening to http://beta-host.co.uk (clicking that link will redirect you many times, spamming your browser history).
When calling said site, it redirects itself to 312tpfk.beta-host.co.uk and that site redirects to 313tpfk.beta-host.co.uk and that one to 314tpfk.beta-host.co.uk and so on. Each time counting the number up by 1 (312, 313, 314, 315).
The trick here is that it changes only the subdomain, which creates a new browser entry each time.
So, if you want to do that yourself create a redirect on your server that redirects to some up-counting subdomain to create a new browser history entry every time or redirect to that site.
You cannot run javascript in a new page after you destroyed your current one (credits to Quentin)

How are users authenticated and customised pages served before a web page renders without javascript?

A good example of this is facebook's mobile view. This is not reliant on javascript and is able to authenticate the user with the server. If they are authenticated it will request and load your custom webpage, and if not you will see facebook's default home page.
How is all this accomplished without javascript and before the page renders? Is it PHP that runs before the DOM is rendered or is it another technology?
FB uses cookies to handle this. Before the page renders the cookie is sent to the server with the initial page load request, if the cookie is still valid you get past the login page, otherwise you need to login again.
Here is how you can see what cookies you have in chrome:
In the top right, click the Menu Chrome menu.
Click Settings > Show advanced settings.
In the "Privacy" section, click Content settings.
Under "Cookies," click All cookies and site data.
To delete all cookies, click Remove all.
To delete a specific cookie, hover over a site, then click the that appears to the right.
You can also choose to remove all cookies created during a specific time period.
https://support.google.com/chrome/answer/95647?hl=en

How to make phantomjs remember a login session?

I am using PhantomJS to test a website. However, when you login to this website, you have to enter a CAPTCHA string. I try to render the page, then enter the CAPTCHA from console and pass it to the CAPTCHA field, but the page reloads again and my string does not match the CAPTCHA anymore. I guess it's a session problem.
So I want to know if there is any way that I can login to this page on a browser (Firefox or Chrome...) and do something so that when my PhantomJS program opens that page, it will lead to the main page, not the login page. Or is there any better solution?

how to navigate user from my facebook application's canvas page to my web page?

I am working on a rails application. I have implemented facebook integration in my application. User can invite his friends to my application. Invitation system is working fine but problem is when any friend of user clicks on request it gets redirected to my facebook applications canvas page. I want that the user be redirected to my web applications landing page instead of in the application's canvas page. I tried to do so by including javascript in page which opens in canvas on facebook.
<script>
window.location.href = "http://www.google.com";
</script>
But it is giving me error as following.
Refused to display document because display forbidden by X-Frame-Options.
How to redirect user to my applications landing page as soon as it land son my canvas page? I want to achieve something similar to pinterest does.
Any help is highly appreciated.Thank you
Your frame doesn't have access to the window object, as that'd let you access Facebook's pages and do nasty stuff to them. You need to do top.location.href instead of window.location.href.
Your facebook application is probably sending the X-Frame headers, preventing Facebook to include your application iside the iFrame in the first place.
Some applications include that to prevent clickjacking, see here for an explanation of how it works:
http://blog.mozilla.com/security/2010/09/08/x-frame-options/
You might want to disable that header and then try again.

Categories

Resources