Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am trying to figure out how to use a querystring with a page I created. Currently my page has a navigation menu that updates the div contents dynamically when you click a link. The navigation menu consists of a bunch of product categories (tomatoes, olive oils, etc).
My problem is that since these are not actual HTML pages, how can I set up a querystring to be able to link to a certain category from a completely different page.
Example:
Landing: products.html
Click 1: products.html?tomatoes
Click 2: products.html?oliveoil
You should use window.location.hash, and instead of using a ? you should use a # to split the querystring from the filename. So if you have products.html#oliveoil then window.location.hash will be #oliveoil. You will also be able to set the hash with window.location.hash = 'What-you-want'.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
We have a landing page on our sub-domain (i.e. landing.ourcompany.com) that we forward people to our Wordpress website page (ourcompany.com/page) but have one content item (with a CSS class) we want to "display: none;" if they come from that specific link (i.e. landing.ourcompany.com). Is it possible with javascript to detect the Referrer link and then add the CSS to the page?
Yes, you can, as you said, in your page you can do something like
if(document.referrer == "google.com"){
document.body.classList.add("googleRef") //or whatever you want
}
then, since the class in on the body, your stylesheet can have something like
.googleRef .divThatIWantToHide{
display: none
}
So the class on the body tag element works as a flag to know what to hide. Take in consideration that the if statement needs to be improved
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have seen websites that create a sharable link that is generated depending on what options the user chooses but I'm not really sure how they're implemented (or what this process is called).
e.g. this website has a share button at the bottom that creates a sharable link for a given selection.
You can do a rudimental but easy solution. Add a URL Parameter to the button link and redirect on click depending on the parameter.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to create a system where the user will input their Wikipedia page link, and the application will get the page title from Wikipedia page URL.
Like, if the user gives: https://id.wikipedia.org/wiki/Eminem, I want to get the page title Eminem.
Or if the user gives: https://id.wikipedia.org/wiki/Eminem#1992%E2%80%931997:_Awal_karier,_Infinite_dan_masalah_keluarga, I want the page title, which is Eminem
I've tried finding a regex pattern. I'm thinking about what if I could create/ find a regex pattern that would find words that sit between /wiki/ and ends with a /. So far didn't found any way to do that.
So what can I do? What other options I have?
this would partly work: /(?<=https?:\/\/..\.wikipedia\.org\/wiki\/).+(?=\/(.+)?|#)/
It doesn't work without a / at the end though.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have created an option that by clicking on span text shows or hides the sidebar. how to remember user selection after reloading page that the sidebar page was shown or hidden depending on the user's choice?
Once you refresh the page, everything that is not stored somewhere, for example a database, will be lost.
The easiest approach would be to save user's selection to his browser's localStorage.
So, after setting the sidebar to whatever state you want, you can save it like this:
localStorage.setItem('showSidebar', true); // or false
and then, when the page is reloaded, you can get the data like this:
var showSidebar = localStorage.getItem('showSidebar') || false;
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have two (or more) links.
First is link (example) : http://website.com
Second is code with: <div> </div>
How can I make them both open when I click on a single link?
For example, a link entitled "click here" which, when clicked, will open two different blank windows.
This is only done with Javascript. Try this:
Click Me