HTML: href of anchor. How to concatenate instead of replace? - html

I am in the page
www.myWebsite.com/registration?type=lookfor
And in the menu I have an anchor to change the language.
English
If I click on this anchor, I will be redirect to
www.myWebsite.com/registration?lang=en
... but the correct result would be
www.myWebsite.com/registration?type=lookfor&lang=en
I could easily elaborate a javascript solution, but I would like to have a simple HTML solution, if there is any.

English
Try this html code for redirect with two query strings

Related

Go to link within same webpage in Angular

I'm just starting angular and am able to display the homepage via the url: http://localhost:8002/app/#/home
Now, I want to use a name tag, to go to 'FAQ' section within the same page by using:
FAQ and <section id="faq">
However, this is not working. Can anyone please guide me here ?
You can also use $anchorScroll (better solution). You can see an sample and more details here. I don't test ng-href but i think it is bad solution.
You should write in the href attribute #/faq, with a slash.
and another issue, is using ng-href, as written in angular docs(https://docs.angularjs.org/api/ng/directive/ngHref):
Using Angular markup like {{hash}} in an href attribute will make the link go to the wrong URL if the user clicks it before Angular has a chance to replace the {{hash}} markup with its value. Until Angular replaces the markup the link will be broken and will most likely return a 404 error. The ngHref directive solves this problem.

HTML anchor and query string

Is it possible to do something like the URL below?
myurl.co.uk/#myAnchor?myQry=this
I'm trying to pass tracking codes while also being able to have multiple links from an email go to relevant parts of my page.
This currently seems to do nothing as it is. Is it actually possible.
The query goes before the anchor, so:
http://example.com/page.php?parameter=value#anchor
Though the query always comes before any anchors, here is the solution for this if required.
One solution for this could be to use Apache HTACCESS and declare #myAnchor in rewrite rules. Then you can use something like this:
myurl.co.uk/#myAnchor?myQry=this
But please remember that in the htaccess the # is also used for commenting so you will have to escape it with a rewrite rule.

HTML page title: localization and empty title

2 questions about a better way of solving the problem:
1) is there is a way to make HTML page title looking different for different locales of the client-side code except for javascript?
I.e. write HTML page title which is shown in the browser's tab in corresponding language.
I know I can use javascript for this, but may be there is another way?
2)I set my HTML page header with javascript (it is a different case). But there is a delay before the script will run. Is there is a way to set HTML page header to empty line before javascript evaluates?
If I remove tag I get the page URL.
If I use empty tag - same thing.
I have to use &nbsp content inside which looks a bit ugly.
Some other options?
I don't see any other means but JavaScript on the client side for this, sorry.
For the delay: try using an inline javascript to change the page title right on top of the page before any other scripts are loaded or executed, but after the page title has been set. This should keep the delay to an absolute minimum.
To the first:
Except Javascript, the only Way i know would be PHP, but using Javascript is a lot better and
easier.
To the second:
arkascha's Post is the answer

Overiding/Appending querystrings

Just a curiousity rather than an acutal need, I've never thought about this, but I can't think of any html which would do this. I could do it in Javascript or Serverside easy enough, but curious if browers can implement this anyway.
Say I'm at a url: http://www.mysite.com/?param1=10
and I have an <a> tag, is there anyway to make it's href so that it will append a new parameter to the qs?
So I could have <a href='?param2=20'>Twenty</a> which would make the url http://www.mysite.com/?param2=20. But I want it to be http://www.mysite.com/?param1=10&param2=20. Conversely if I was on http://www.mysite.com/?param1=10&param2=20 and there was a link to turn the url into http://www.mysite.com/?param1=30&param2=20, by only specifiying the param1 parameter in the tag? <a href='?param1=20'>10</a>.
If that makes sense? So can this be done just with html, no js or serverside, and not form submissions, just <a> tags?
Short answer: no. HTML is not a programming language, just a markup language.
No, it can't be done. Links can be relative to the site (with leading slash):
link
or to the page (no slash)
link
they can lead to a local anchor ( with a #)
link
or they can be absolute
link
or of course combinations of the above with local anchors.
But they can't append to the query string.

feed text parser

I'm getting text from an API and it's something like following:
text = 'replied to #james and he was visiting this http://some-site.com/another/something/../ so what you think about it';
How can I parse this text and make links as html links and #james as html links also, but with their own href values.
Does anyone know any function that already does that or can someone paste their own function here please?
Depends on the language you are using (it's not clear from your question). But you can transform your links and #text into clickable URLs with regular expressions.
This google search will point you in the right direction.