I am developing a shopping site where user can search products using different criteria.
On checked_changed event of check box i want to change URL, but condition is that my page does not make full post back..
This answer will help you......
You need HTML5-able browser and some JavaScript. Here is the demo of HTML5 history feature.
GitHub implemented that feature for tree browsing. And there is screencast in railscast.com.
Original answer is :
change url without making page postback -- mvc
Perhaps this is the solution http://www.asual.com/jquery/address/ - asual provides the functionality for easily changing addresses on the fly
What I can see there is the same functionality where we link an anchor tag to a div in the same page by appending #. You can see the the URL is changing by just appending the #!gender=men/page=1 to the end.
Also there is no checkbox. I saw that portion in firebug. Its just an image. But we can achieve it through checkbox as well on the onclick event but just appending the #[your params] to the URL.
Thanks,
Sayed.
Related
Whenever I append a query string in the url of a page containing FullPageJS, this querystring is removed on section change event. I want it to be retained even after section is changed. Any help would be appreciated.
Feel free to open an issue for it in the github issues forum.
As far as I can see the only solutions for it at the moment are:
Remove your anchors option from your initialisation to stop using anchors in fullpage.js
Use the query string before any anchor is added to the URL. Try this url for example: https://alvarotrigo.com/fullPage/?demo=aaa
Right now when the user inputs a word in the textfield and hits search, the form submits using $.get(). The data(JSON) is fetched from the server and then the UI is updated.
What I want to do is pretty simple:
1) When the form submits, the URL of the browser needs to update (something like search/zyx, zyx is what the user is searching for).
2) when the page is booked into favorites, or clicked as a link from somewhere the page needs to load and then the textfield value have to be 'zyx'. Also the UI needs to show search result of zyx.
This is important to my app because I will be using Google Analytics. So the URL is needed to reflect behaviour. Plus the other issue like back button history. Is this possible using just jQuery or some extremely light libraries build on jQuery. I have searched everywhere and all the solutions I found were using MVC frameworks. Or another solution was to use a templating framework like this one. However my app is way too simple for these solutions.
So, the approach you you need is to listen to hash changes in the url and based on this get the current page and render it in a cointainer. Something like this:
Go to Page 2
<div class="page-container"></div>
<script>
$(window).on('hashchange',function(){
var page = window.location.hash;
$.get('pages/'+page+'.html', function(pageContent){
$('.page-container').html(pageContent);
})
});
</script>
Thank you every one. So I ended up using a combination between #Tulio Faria 's answer and #Gabriele Mantovani.
To get the search keyword from url I used window.location.hash
To update url used history.pushState({id: 'query'}, '', 'some_url_string');
Used $(window).on('hashchange',function(){...}) to load page of the current search keyword if either back or forward buttons of browser were clicked
If I understand you want to change the URL of the user when some actions are done. There is an other topic about it HERE, and they use
window.location.replace(url)
Hope it helps you :)
I have a page (http://myflashpics.com/picture/p9e0) with some user information in the side and small thumbnail in the side. What it's doing now is linking to a whole different page and the sidebar reloads as well. I was wondering if it was possible to change the image, comments section, the caption, as well the URL so if the user wants to link to it anywhere.
This might not be possible - but if it is I don't even know where to begin Googling this or even starting to comprehend how this will work.
All answers are appreciated! Links and source code would be nice too.
In browsers that support HTML5, you can use window.history.pushState to perform AJAX partial loading of pages and still completely change the URL of the page. This is what GitHub uses (see some more info as well as a video demonstrating the technique at their blog post, The Tree Slider). There is some great info on the subject on the Dive Into HTML5 History API page.
On browsers that don't support HTML5, you either must use location.hash (if you want linkable URLs) or else don't use AJAX (and stick with your current implementation). I am in the camp that uses jQuery for this task.
sounds like a situation for
jQuery history plugin
jQuery.ajax() – jQuery API
In short, you can't change the URL without reloading the page but you can use AJAX to load new data ad if the page had changed. You can also track history by changing anything after the "#" in the address bar. A good example of a site that implements this is grooveshark.com
You can do this simply using ajax. If you need to change the urls change the location.hash property using Javascript.
I have a page where in a photo and description link is there, i want replace the hard coded link with a javascript,which will add them,as i dont want the search engine to scroll the links.I dont wanna use "nofollow" attribute.How to code it in js.
Update: I may have misunderstood you - I thought you want to keep search engine visibility. Can you clarify which one you want? If you don't want the links and images to be indexed, I'd say nofollow is in fact your best friend. A JavaScript based solution is of course doable, but will lock out clients that don't have it enabled.
Original answer
The usual way would be to keep the link in a standard href attribute, and adding a JavaScript onclick event that does its thing using the href, and returns false so the "normal" link doesn't get triggered.
This leaves a search engine-readable link in place, and enables clients with JavaScript disabled to still somehow access the image.
This technique is also known as progressive enhancement.
I would be surprised is Google couldn't handle links created from Javascript. If you want to keep the linked pages unindexed, use nofollow on the link or noindex on the target page or add them to robots.txt.
I want to link to a page which contains multiple support topics.
When the user clicks on the link while being on an external site, the topic should be expanded as soon as the user arrives on the support page.
Example:
I link to this page
http://www.nintendo.de/NOE/de_DE/support/nintendo_ds_lite_159_142.html
Topic I want to be opened on arrival
javascript:fadeNAppearDiv('box_3_9277');
(First topic in the FAQs)
It's not clear if you are maintaining the target site (where the div will open) or not. If you don't have access to the code for that page, then there isn't any way to invoke the javascript function on it. If you can modify that page, you can do as #PhiLho suggests and modify the URL you are using to specify the DIV to open and have an onLoad handler that parses the URL and opens the appropriate DIV.
Good idea, but I don't see the question... :-)
The way I saw on some sites, like deviantART, is to use the sharp anchor notation: myURL.com/foo/page.html#TopicToExpand
JS can analyze the current URL and get the anchor part, then do whatever you need to do to highlight/jump to the right place.