Microsoft Edge and IE11 doesn't invoke servlet - servlets

I'm testing an existing web app from a Windows 10 environment.
Current versions of Firefox, Chrome and Opera work as expected but Edge and IE11 don't.
The welcome page (html) of the app displays correctly but when submit is invoked nothing happens i.e doesn't move off welcome page and run the servlet. There are no error messages, no relevant server log entries. When I run the app from within a NetBeans IDE the monitor shows only the requests for the welcome page, none for the servlet request.
The symptoms are the same for Tomcat and Glassfish.
IE9 on a Windows XP system works so, for fun, I played with x-ua-compatible settings in the welcome page html but no resolution.
Any pointers would be appreciated.

Sampson - playing around with the welcome html file, I have found a solution. The original code segment was
<div class ="text">
<form id="plant_select" action="Search">
<input name="name" placeholder="enter name" class="inputtext" autofocus required>
</form>
<p style = "padding-top:20px"><input type="submit" value="Search" form="plant_select"></p>
</div>
By moving the submit line into the form tag thus
<div class ="text">
<form id="plant_select" action="Search">
<input name="name" placeholder="enter name" class="inputtext" autofocus required>
<p style = "padding-top:20px"><input type="submit" value="Search" form="plant_select"></p>
</form>
</div>
The app now works for IE11 and Edge.
The original code worked for all available browsers at the time and was passed by an HTML5 validator. Hope this is of interest to you.

Related

Logging in and scraping a site like ft.com with BeautifulSoup

I have this url: https://www.ft.com/content/87d644fc-73a4-11e7-aca6-c6bd07df1a3c
It corresponds to an article that requires signing up. I signed up and can see the content in my browser. However when I use this code with the url above:
soup = BeautifulSoup(urllib2.urlopen(url), 'lxml')
with open('ctp_output.txt', 'w') as f:
for tag in soup.find_all('p'):
f.write(tag.text.encode('utf-8') + '\n')
Especially, it redirects me on the signup page. Is there any way to be logged in to have access to the article when scraping?
Here are the basics.
Go to the login page. If you use the Chrome browser you can position your mouse over the email input area and use the context menu (in Windows) and then its 'Inspect' entry to reveal the form element that will be used to submit your email address. It looks like this.
<form name="enter-email-form" action="/login/submitEmail" class="js-email-lookup-form" method="POST" data-test-id="enter-email-form" novalidate="true">
<input type="hidden" name="location" value="https://www.ft.com/content/87d644fc-73a4-11e7-aca6-c6bd07df1a3c">
<input type="hidden" name="continueUrl" value="">
<input type="hidden" name="readerId" value="">
<input type="hidden" name="loginUrl" value="/login?location=https%3A%2F%2Fwww.ft.com%2Fcontent%2F87d644fc-73a4-11e7-aca6-c6bd07df1a3c">
<div class="lgn-box__title">
<h1 class="lgn-heading--alpha">Sign in</h1>
</div>
<div class="o-forms-group">
<label for="email" class="o-forms-label">Email address</label>
<input type="email" id="email" class="o-forms-text js-email" name="email" maxlength="64" autocomplete="off" autofocus="" required="">
<input type="password" id="password" name="password" style="display:none">
<label for="password">
</label></div>
<div class="o-forms-group">
<button class="o-buttons o-buttons--standout o-buttons--big" type="submit" name="Next">Next</button>
</div>
</form>
You will need to gather the action attribute from the form element and all the name-value pairs from the input statements. You use these in a POST request with the requests library.
You do this once for your email address and once for your password. Then you should be able to issue the GET for the URL with requests.
I must warn you that I haven't actually tried this with that particular site.
If you are to scrape a website using BeautifulSoup, I'd recommend the MechanicalSoup library. It is a very lightweight layer on top of BeautifulSoup (to parse HTML) and requests (to fetch pages), but it will deal for you with things like filling-in a form properly (i.e. what you need here), following relative links, ...
MechanicalSoup is also limited in the sense that it doesn't interpret JavaScript code, hence won't work on a website relying on JavaScript, but it reduces the manual effort compared to using BeautifulSoup and urllib or requests directly.
(Note: I'm one of the authors of MechanicalSoup)

Why are my html5 labels not displaying in Live Web Preview?

I added this (taken straight from a book, "HTML5 24-Hour Trainer") to Default.aspx in an asp.net web project:
<form method="post" action="">
<fieldset>
<legend>Personal details</legend>
<p>
<label for="Name"> Name:</label>
<input type="text" name="name" id="Name"/>
</p>
<p>
<label for="Email"> Email:</label>
<input type="text" name="email" id="Email"/>
</p>
<p>
<label for="Tel"> Telephone:</label>
<input type="text" name="tel" id="Tel"/>
</p>
</fieldset>
<p>
<input type="submit" value="Submit"/>
</p>
</form>
The labels ("Name:", "Email:", and "Telephone:") are not displaying next to the text input controls (edit boxes) - or anywhere else (visible to me) for that matter if I select "Live Web Preview" (Ctrl+Alt+Enter). However, if I select View In Browser (Ctrl+Shift+W), I can see the labels.
And if I look at the page in any of my three options (Google Chrome, Internal Web Browser, or Internet Explorer), it works fine; it is only the Live Web Preview that is busted.
So the question is, why are the labels invisible with "Live Web Preview"? But I guess I'll just avoid that viewing option; no big deal.
Tried the exact same thing and it works as expected. I guess it's a local issue. Need more info.

Logging in to my site opens a new tab?

I've been working on my personal website as of late, and even thought it's not a big problem because I'm the only one that sees it, it's annoying nonetheless.
Whenever I go to my login page, it all works fine. If I enter a bad username/password, it will just print a simple text message error(intended). But, if I login correctly, then instead of redirecting to the root of my website as I intend, it will instead create a new tab in firefox and from there it will be in / (which is correct). The problem is why does it create a new tab? I didn't even think forms were capable of such a thing:
My full login page is at http://lastyearswishes.com/login The gist of it is:
<form method="post" target="/login">
Username: <input type="text" name="username" /> <br />
Password: <input type="password" name="password" /> <br />
<input type="submit" name="Submit" />
</form>
And my server side code is also very simple:
if(RouteID=="login"){
if(AuthenticationModule.Login(Form["username"],Form["password"],false)){
//logged in correctly
Response.Redirect("/"); //just go to the root of my site
}else{
Write("You fail at life");
}
}
«target="/login"» means "open in window named «/login»". If it doesn't exist, a new one is opened. I think you meant to use
<form method="post" action="/login">
HTML Form Element

Any work around for this issue -- when going back and forth between pages in Firefox the focus is lost at different points

I have a page that is rendered through xulrunner service. There is a form and a button under the form.
For accessibility requirement, I forced the focus on the text field within the form when the user navigates to this page. However, sometimes JAWS always reads the Post Comment button label. Sometimes, JAWS reads the aria-label “Enter Comments”.
Here is the code:
<body onLoad="document.addcommentform.comment.focus()">
<input type="textarea" aria-label="Enter Comments" title="{$enterComment}" name="comment" />
<input class="Button" type="submit" value="{$postComment}" />
I also tried to put a visible label on the UI like this. I did more testing and found out the behavior is pretty the same.
<label for="addcommentform">Please enter comment
<form method="get" action="{$self}" name="addcommentform">
<textarea title="{$enterComment}" name="comment" class="commentarea" </textarea>
<input class="Button" type="submit" value="{$postComment}" />
</form>
</label>
I think it is related to this known bug https://bugzilla.mozilla.org/show_bug.cgi?id=133771
But does anybody known any workaround to this issue?
I'm a Jaws user and don't know of a way around this. Since Jaws tends to create it's own model of pages in a virtual buffer things can behave slightly differently then you would expect. To confirm or disprove weather it's a Jaws specific bug I would suggest trying out NVDA an open source and quite good Windows screen reader.

IE not offering to save passwords on my login page

I'm developing a basic login page in ASP.NET.
The page includes an email field, a password field and a submit button.
For some reason Internet Explorer doesn't offer to remember the login info, while other browsers such as Firefox & Chrome do.
For other pages (Gmail, Twitter etc.) IE als offers to remember password.
Please note that I am not using a username that I previously asked IE not to remember the password for.
Basically, how does IE recognize a login page, and why won't it recognize mine as such?
Thanks
I had similar problem while developing simple login form which submits itself by tag <a> instead of <input type="submit">. But the form was not developed under ASP.NET (which i do not know what is).
The problem was solved thank to the following article: http://blogs.msdn.com/b/ieinternals/archive/2009/09/11/troubleshooting-stored-login-problems-in-ie.aspx
The article discusses main prolems with occurence of "remember password" dialog in IE. My case was number 5 in that article. I inserted AutoCompleteSaveForm() method before submit() one and IE started to display the dialog.
Breafly speaking, the incorrect form code was:
<form action='javascript:void(0)' method='post' id="form_id" >
<input type="text" id="login_text" /><br/>
<input type="password" id="password" /><br/>
Login
<form/>
The correct one was:
<form action='javascript:void(0)' method='post' id="form_id" >
<input type="text" id="login_text" /><br/>
<input type="password" id="password" /><br/>
Login
<form/>
Hope this helps.
Best Regards,
Ilya.
I know this post is quite old but I was running into this same problem. My issue was that I had converted the Login control to a template and because of styling concerns I changed the default asp:Button to an asp:LinkButton.
Internet Explorer apparently looks for an <input> tag in order to save passwords. The link button renders an <a> tag so IE wasn't recognizing my Login control as a valid login form.
Hope this helps!

Resources