Calling Servlet from HTML - html

i want to call servlet everytime when an html page is loaded.In other words HTML page calls a servlet link automatically not via form.
For this am using below meta tag in html page,
<meta http-equiv="refresh" content="0; url=http://zerocool:8080/practice/WelcomeServlet?123">
Now when a user visits HTML page he gets redirected to servlet,and this servlet after analyzing the user redirects him back to the original HTML URL or someother URL depending upon valid and invalid user.
Now my question is,by adding above meta tag will the website be punished by google search engine or not in terms of SEO/ranking as user is redirected twice,1st to servlet and second back to html page.But all this happen very fast.
OR
You can suggest some alternate way to call servlet.
Actually servlet will be monitoring cookie in users browser to validate user

This way it is likely to end up in an infinitive loop which is extreme annoying for the user.
You should either use Ajax or apply an redesign. You can't protect a html page against users while allowing google to view it.
ONe way to protect pages is FIRST to check whether an user is logged in and if so show the protected page, otherwise collecting authorization data.

Related

What is the correct way to change html dynamically using django

Suppose we have a login page where, in the first stage, we are asked to enter our email. We send this information to the server, which searches whether there is an account with this email, and if there is, our goal is to change the state of the page, to a page where the user is asked to enter the password for this account. If, on the other hand, there is no account with that email, the state of the page changes to one where the user signs up. And let's say that, for the sake of aesthetics, all this happens using the same url.
My question is, what is the correct way to inform the client's page to what stage to go into?
Sending the whole html code is an option, but this seems like it will put too much pressure on the server. Is there a cleaner way, that we can send less information, and still be able to have the same result?
I am new to django and web dev so please explain thoroughly.
For a browser engine submitting a form with email is a new page request and a new rendering of HTML after that. The source of new HTML code is your server with Django, so you should generate a new HTML with a relevant template and send it as a response.
Such user provoked events change a state of your application for a given user session, not a page.
For speed you can use caches for styles, for menus, for HTML snippets (headers and footers).
Also you can make a one-page application, but you must use JavaScript framework for it. Then your JavaScript code executing in client's browser can request concise JSON with necessary information instead of full HTML.
Then your JavaScript framework is responsible for a correct insert new dynamic HTML elements in the current document object model (DOM).

Redirecting unless client has come from paypal

I'm trying to have the HTML code check where a client came from so they can only access this page through a link and we will say this link is from Paypal after purchase and if they don't go through Paypal they will be redirected to the home page of my website, in this case, is home.com (not really).
My Code:
if(!isset($_SERVER['HTTP_REFERER'])){
<meta http-equiv="Refresh" content="0; url='https://bypassdetected!'" />
header('location:../index.php');
exit;
You would need to check if the contents of HTTP_REFERER includes 'paypal.com', although this is a dumb sort of check since it's easily spoofed and accomplishes little of value
Regarding the action your code then takes, you can't combine HTTP header location redirects with HTML redirects, it's one or the other, but if you do try to send both, the headers have to be set before any body content
Redirecting over to PayPal should be avoided in general. You should switch to a PayPal integration that does not use any redirects at all, such as this one: https://developer.paypal.com/demo/checkout/#/pattern/client -- then, your site always stays loaded in the background, which is a far better modern web experience

How did gdprscript.js get into the header of my Weebly site?

When I view the source of my website, I am seeing this script inserted into my website. However I cannot find the template where it is being added.
This javascript html tag is inserted automatically by Weebly's backend server itself. It inserts it immediatly after the <head> element and before any items you have defined in your actual template file.
<script src="/gdpr/gdprscript.js?buildTime=1558379751&hasRemindMe=true&stealth=false"></script>
What does it do?
This code forces the display of the "This site uses cookies..." message that pops over the bottom part of the page. It also handles the user's selection.
Why is it inserted if my site does not use cookies?
It is inserted because Weebly itself forces your site to use cookies. It does this to enable its own collection of analytics on your homepage.
Does it slow down my site
Yes. Code like this should be inserted after the site content.
Can it be removed?
You may be able have this removed by contacting Weebly directly.

href: Can I get Google search results to use/display the final redirect url?

My site has webpage urls that use the following format:
www.mysite.com/id/pretty_title
The front page links to these pages, but the href actually contains some parameters:
www.mysite.com/id/?some_ugly_parameters_to_let_me_know_what_search_it_is_from
This then redirects to
www.mysite.com/id/pretty_title
which shows the page.
My issue is that Google's search results show the link to the page as the ugly one instead of the pretty redirected one. Besides looking ugly, it can cause errors because the parameters that are included in the ugly link are irrelevant to a user who directly enters a page from Google.
Can I get Google to only use the final redirect url? Or otherwise avoid this issue? I do need to pass these parameters along. Storing info in the session won't work because a user can have several tabs open.
On the "ugly URL page" you put <link rel="canonical" href="www.mysite.com/id/pretty_title"> which tells the search engine your preferred URL for that content.
Can also set www.mysite.com/id/?some_ugly_parameters_to_let_me_know_what_search_it_is_from to have a 301 redirect to your pretty URL
Canonical URLs: https://support.google.com/webmasters/answer/139066
301 Redirects: https://support.google.com/webmasters/answer/93633?hl=en

Prevent Search Engine Indexes a Web Page

I have a members control panel page which I don't want search engine to index.
I did the following:
The page is secured, if there isn't a session or password provided, then direct user to main page. Redirect the user as following:
header("location:HOME PAGE");
exit();
I put only one meta with the following attributes
name="robots" content="noindex,nofollow"
Is this solution good enough?
If the page is secured, its content cannot be indexed. Even if, its content will be low rated.
How do you redirect the user? Using response header or HTML meta redirect / JavaScript?
you can use robots.txt for more info see http://www.google.com/support/webmasters/bin/answer.py?answer=156449
The meta data is irrelevant, if the page redirects any unidentified user to a different page, then the redirecting URL will never be indexed.
Most search engine robots (all legitimate ones) will respect this instruction. However, all you have really done is ask the robot nicely not to index your page. It does not force any sort of behaviour, merely requests it.
You could...
Require auth to view the page. The robots will not be authenticated, and therefore cannot view the page to index it.
Return a 404 error to any request where the User-Agent: string is in a list of known search engine robots. There are plenty of sites out there (such as this one) that will easily allow you to compile such a list.