Does html structure make difference in get or post request? - html

I have a href , when i click on it, it goes with "POST"request.
(PS. i am using magento 1 framework)
<li>
Logout
</li>
when i remove this "login-popup-in-footer my-account-text" it goes with GET request which is ideal.
I am not sure if HTML Or htaccess file makes difference in GET OR POST request.
Feel free to share thoughts.
Thankyou

Neither, at least not directly.
The HTML you have will trigger a GET request. It can't do anything else.
It will be some client-side JS that is searching the document for elements which are members of one or more of those classes and adding an event listener that prevents the default behaviour of the link and makes a POST request.
Your server configuration can't influence it either. While it could issue a redirect response there is no way for one of those to response to a GET request in a way that causes the browser to make a POST request (although the reverse is not true).

Related

Is it possible to put several URL in a href parameter?

I want to put a link with the <a> tag on my website page, but with multiple URLs in case the 1st one doesn't work. I would be something like this:
<a href="url1;url2;url3"
But of course this doesn't work. So is there a way to do this ?
Thank you
The closest you could come would be to:
Put a default URL in the href
List alternative URLs elsewhere (such as in a data attribute)
Bind a click event handler that runs some JavaScript which prevents the default behaviour and then tests each URL in turn until it finds one that works (or runs out).
Testing would require Ajax which would require either:
Permission via CORS from each URL you test
The user of a proxy (which would test availability of the URL to your proxy and not to the browser)
The additional HTTP requests would consume bandwidth (and thus time).
What do you mean by "1st one doesn't work" ? That the server is sending an error ?
It's not possible to do what you want just with HTML.
It could be done by Javascript by adding a listener to the anchor, sending HTTP request on the first url to see if you receive 200 or an error like 500.
In case of an error, you check the second url and so on and redirect the user where you received a 200.
Otherwise, if you just want to open all the links, there was already a post about that here: How can I open multiple links using a single anchor tag
There's no way of doing this with pure HTML since HTML can't detect whether or not what you mean by "doesn't work" applies to a given URL.

Unable to submit form with POST

Here is the code to my site:
http://pastebin.com/jVk0aPW4
When I try to submit the page, it does nothing. This is the first time time I've tried to submit on this webserver. The network admin assures that POST and GET are explicitly enabled.
Is my HTML malformed? Or do I need to dig deeper on the server side?
You have a nested form, which will cause your form to explode (proper technical jargon).

Spoofing HTTP-request Referrer from HTML?

Is there some secret and mystical way to change the value of my HTTP-request's referer, or at the very least, keep it from showing? Also, using a MitM page from another domain would not solve my issue, as you are now just submitting that other page's value.
This is not browser specific, I would need to do this on the HTML level.
The problem I am facing is a silent-login page where it sends an HTTP-Redirect to the http-Referrer, unless it is the same domain, or empty.
You can not control this on an html level. Your only option is to modify the login code to not issue the redirect or to direct it to the desired page.
It's an old question, but I know how you can do this. The first way is not guaranteed across all browsers, but you can use rel=noreferrer. AFAIK GC is the only UA to currently support this but it is in the standard. FX may also, IDK.
The second way is far more reliable, and it involves a cool little hack someone shared with me on IRC:
Basically, construct an iframe from a base64-encoded data: URI. The framed document is to have a script that listens for a window.postMessage() and when it gets fed the command with a URL to visit, it executes window.top.location = msg.data.URI or however it is that one reads the message. Sorry I can't recall, I haven't slept for a few days.
Enjoy if you still care.. :)

Why is a html form post to a restlet resource not working?

Restlet's (2.0M6 on Google App Engine) annotations are actually sensible to the order of a resource's methods.
When posting html form data, make sure that the #Post("html") method stays above the #Post("xml") method in the receiving resource.
At least Firefox puts both content types into the request's Accept header, so the first matching method will be processed.
The question is, if there is any other way to achieve control over method precedence?
For example I would like the client to accept text/html only.
As per your comment that you're asking whether there is some kind of client-side html form attribute or JavaScript to modify the accept header, the answer would be, AFAIK: no. Not for links clicked or forms submitted by the user. As you mentioned in your comment, you might be able to use JS to intercept link clicks and form posts, and use XHR instead, but that'd probably be tricky, if possible.
BTW, XmlHttpRequest doesn't really have anything to do with XML. It can handle any sort of content, for both requests and responses. It's very common to return a snippet of HTML to a XHR request and use DOM injection to dynamically update the page.

How can I post data (form) to html page and hijacking the data in the middle?

the site addres: http://www.ynet.co.il/YediothPortal/Ext/TalkBack/CdaTalkBack/1,2497,L-3650194-0-68-544-0--,00.html
fill the form with rubbish.
Hit 'Send'
the form post the data to another HTML without any parsing of the data i've just added
How do they do it?
A likely option is that they are using a content management system where "html" on the URL doesn't actually mean it's a static html file.
This may be out of left field, but I've certainly used the occasional JS function to grab everything in the header and either parse it or pass it to another script using AJAX.
I'll sometimes use this method in a 404.html page to grab the headers of the previous page, parse them out to see where someone was trying to go and redirect them.
That is, as annakata said, one of the numerous options available.
Edit based on clarified question:
Numerous frameworks can be configured to intercept an html request - for instance asp.net can be set to handle any given extension and an HTTPModule could do anything with that. It's really up to web server configuration what it decides to do with any request.
also: you don't really want to be saying "hijack"