How to retrieve longDynamicLink from suffix Firebase Dynamic Links - javascript

I have created a dynamic link using firebase for eg:
https://fineshopdesign.page.link/hob
And the long url of this suffix is:
https://fineshopdesign.page.link/?link=https://www.houseofblogger.com/&st=HOB+x+FD&sd=Hii,+it%27s+HOB+(House+Of+Blogger)&utm_campaign=ghgh&utm_medium=ghgh&utm_source=ghgh
Now, I want to retrieve long url from short suffix so that before redirecting the user to link, I could get some information of the link and after making sure I will allow user to open the link in my web web. For eg. if the querystring has link which matches a regex.
Is it possible to get the longDynamicLink from shortLink using javascript?
I searched for it on Dynamic Links Documentation but didn't get any way.

Related

How would custom user links work?

By custom user links, i mean like for example when a user registers to the website, a page is created specifically for that user with a link.
For Example
https:/domain.com/users/customerName
Then after creating the link, the website will automatically customize the website by using a clone of a specific webpage.
*Btw i've already took Care of the Login/Register part. I just need to know how custom user links would work.
Option 1: example.com/user
Use a single PHP file and an .htaccess file. Check out How to create friendly URL in php?
Option 2: user.example.com
Create sub-domains for each user, also uses .htaccess. Check out How to let PHP to create subdomain automatically for each user?
Option 3: example.com?user=name
Create a single php file and use $_GET parameters. This is the most usual and easiest way to customize the website based on the user who registered and logged in. (usually using user ID number: example.com/profile.php?user=71)
Of course there's also Session handling.
I think you searching for URL rewriting concept.
If user login the page no need to clone the page.you could access the same page with this user data and specification(dynamic page).Many the page content with php functions
URL rewriting
you could the function in .htaccess
if user enters the page
http://example.com/someuser
its rewrite the url with
http://example.com?q=someuser
if you see the url bar its like special page for the user.
It's actually fairly simple. You just use GET within PHP and the URL would be something like http://example.com/user?id=4453623 - If you've ever been on facebook you'll notice they use PHP for the profile pages and much other things too. If you go to your profile page, you'll notice a "id=" variable up in the URL and that's how they determine which profile page to display to you.
This is basically what #Granny commented.

Dynamic URL in vanilla JavaScript for multiple links

I have around 50 links in footer section in this static app. Is it possible to not create html files for all 50, instead create one html file with data related to all 50 links and hide/show relevant data based on clicked link?
Scenario:
User clicks a link, referred to url as http://{url}/clicked-link-id/
User sees data based on the clicked-link-id
I know its easy with Angular, but I am not allowed to use ui-router or any other framework/libs.
One approach which can be followed here is to parse the url to retrieve the clicked-link-id using JavaScript.
Once the clicked-link-id is obtained, a function can be written to display the element with content related to the link.
There are many ways to split the url to find the relevant info.
One crude way to do it assuming the link retains the structure shared by you:
var url = document.location.href;
var splitUrl = url.split("/");
var linkId = splitUrl[splitUrl.length - 1] || splitUrl[splitUrl.length - 2];
There are other things which also need to be considered here.
There needs to be a configuration probably on the web-server side to redirect all the page requests with a certain structure to the page which contains this logic. Otherwise you might get 404 error for all such requests.

Modify href -or- URL Redirect / Rewrite and pattern matching using javascript or jquery

Im struggling to figure out the best way to redirect/rewrite urls with some pattern matching using javascript.
BACKGROUND:
I have a blog filtered by tag: http://adrtimesv6.squarespace.com/library/?tag=The+Psychology+%26+Neuroscience+of+Mediation (select view as visitor if that comes up)
I have another area in the site called "Collections" where i load in groups of posts from the library in its own real page with other content in a more controlled environment with page titles and urls that are better for seo, like this: http://adrtimesv6.squarespace.com/collections/the-psychology-and-neuroscience-of-mediation. the posts are loaded in via a query that pulls in posts from the library that have a tag that matches the name of the collection page. this is working pretty well. the problem im running into is that when someone filters the blog posts by tag i want them to be redirected to the collection page rather than go to the blog filter page.
QUESTION:
What im trying to figure out is how to use jquery to redirect all the /library/?tag=[path] urls to /collection/[path] urls. To do this i think i need to use jquery to:
1) swap "/libary/?tag=" to "/collections/"
2) revise the rest of the path from the tag formatted path "The+Psychology+%26+Neuroscience+of+Mediation" to my collection formatted path: "the-psychology-and-neuroscience-of-mediation"
ADDITIONAL INFORMATION:
I am using a CMS so i dont have access to things like the .htaccess file. in the CMS admin settings there is a url redirect panel that allows me to list some basic redirects in this format: -> ... but trying this with the tag filter urls is not working.
Im mostly concerned with this redirect occuring when the user clicks on the tags listed at the bottom of the blog post - so i could use jquery to modify the href attribute in the tag listed for the blog post. just not sure how to write the pattern matching and rewrite the format correctly. ive tried a bunch of things but cant seem to get it.
or perhaps use window.location.replace somehow?
UPDATE:
In my particular case, i found that i could update my template code and json formatters so that the tag link href generated matches the url in the collection section - so my problem is solved ....however, i still wonder how i would do handle this for other situations.
basically, 1) how to use javascript or jquery to check if the url (either href on the page or the browser url) contains something, then replace that with something else, and then modify the full url so that it is a simple dashed url .... takes out all + signs and replaces them with - and removes the %26 for & characters to return a simple url string, etc, like: /here-is-the-path
On a single page, you can use this to forward a visitor to a new page:
window.location = "http://www.google.com"
You could add logic to use the same script on every page. For example:
if ( document.location == "http://adrtimesv6.squarespace.com/library/?tag=The+Psychology+%26+Neuroscience+of+Mediation" ) {
window.location = "http://adrtimesv6.squarespace.com/collections/the-psychology-and-neuroscience-of-mediation"
}
and so on. You could even add more advance string manipulation to handle every URL.
But doing a JavaScript redirect in this manner will not have positive SEO effects such as friendly URLs. It will not enable your web server to handle the new URL; if http://adrtimesv6.squarespace.com/collections/the-psychology-and-neuroscience-of-mediation returns an error from your web server, no amount of front end JavaScript will be able to fix that.
Doing this with JavaScript this would probably be a negative experience for your users, because they would first have to download the page from the first URL, then execute the JavaScript, and then download the page from the new URL.

can not Hyperlink a URL

I Have a url Which i want to hyperlink on my website but that url is not working after giving hyperlink or copy-pasting in the web address bar or refreshing the page, that url is only working from the original website. . . . If Open the link from original website its opening but Source code is invisible . . . .please help me
URL is
http://jntuconnect.net/results/results/zMO9-z4RtsGFvQq5BcFyav1G9WYwHAkyfMoH49pbaATJCr3zhnoPJnBVYvTw_4fBxyMLLmVLHauTIwzoqJSTHA,,
Please help me in hyper linking it
You are trying to link to a results page that is dynamically generated and behind a CAPCHA.
My guess would be that the long string of hash at the end of the URL is an encoded string that contains a time stamp or some other expiring method. Also since the page you want is behind a CAPCHA check that long hash at the end of the URL probably also encodes some sort of "success" message that says you filled out the CAPCHA. It wont be possible to link directly to the "results" page because it doesn't exist until some query parameters generate it.
A better option would be to see if they "iBongo" offers an API you can query. iBongo seems to be the company that is powering http://jntuconnect.net.

Javascript, jquery, ajax url query string rewrite

I thought this would be easy but I guess I was wrong. I have a url;
http://www.example.com/aa/bb.html?uid=123
using javascript jquery and html, I am able to retrieve data from a json api with the uid in the sample url above. However, I don't want that url displayed like that in the address bar after the data has been parsed. Rather, I need it to display as;
http://www.example.com/aa/item-title
where item-titleis the title of the data referenced by uid=123.
A php mod-rewrite would have been ideal, but this project does not make use of server side scripting.
Thanks in advance
If you change or modify the URL then the browser try to fetch data fro the new URL. You can do something with the part of URL after # mark.
Like :
http://www.example.com/aa/bb.html?uid=123#old_part
to
http://www.example.com/aa/bb.html?uid=123#newpart
I can see only one solution to your problem as you don't want to use mod_rewrite. You can redirect from first page just changing the URL based on the given uid value to the next page you want to display.
First page - read parameter uid and build the redirect URL based on the title(not any other stuff in your first URL page)
Redirect to the built URL
In redirected page do the rest of page specific stuff.

Categories