I'm using history.js (https://github.com/browserstate/history.js - with the jQuery port) and I cant handle the "first step" (the origin one).
I.E. I'm from "/myPage", then I go to "/myPage/myContent2" and to "/myPage/myContent3" : it change, using AJAX, a part of the page. When I press the "previous" button, I come back to "/myPage/myContent2" and all is OK, but if I press it again, I'm back to "/myPage" (in adress bar) but my original content doesn't display :/. I've got an empty space in place of my content.
You could see live exemple here (it's not an Ad! But my online website - in french) : http://www.variance-auto.com/kits-film-teintes/vitre-teintee-Audi?choix_film=1 (that is equal to "/myPage")
Click one or more "modele" in the list on the left of the page.
In this live example I made a "hack" to avoid part of this problem : I double the first step using a "History.pushState" on the page load, that "save" the data of the first step. But you could see that you need two hit on the "previous" button to get back to the real previous page.
Thanks for your help.
I did an article on this a couple of days a go.
Have a look at it and if you need any further assistance let me know, I'll do by best to help.
The URL is:
http://www.codeproject.com/Tips/758486/Make-an-MVC-Application-into-a-SPA-with-AJAX-and-H
Related
I'm currently looking for something to do the following:
scenario:
user clicks button on page 1-15 and navigates to page 16, user does several actions, and when clicking on a 'confirm' button, he needs to return to page 1-15 (whichever he was on earlier).
How could I do this? I was thinking to simply write the URL in a cookie which can then be read out and adapted in the final destination URL.
Or am I looking in the wrong direction? Some code examples would be helpful as knowledge is limited.
use sessionStorage.setItem('currentPage',1);.
then when you need to use this number just call sessionStorage.getItem('currentPage')
I want to click the "continue" which is given on the end of this page, note that the site is not mine, its someone else's. The element is located after the pagination,
I tried to click it this way :
//Method 1
document.querySelector(".se-pagination-button.se-pagination-button--next").click();
//Method 2
document.querySelector(".se-pagination-layout").lastElementChild.click();
But unfortunately it did not work for me. Is there anyway I can click it ? Because when you click it through the mouse or pad, it triggers a function. But not when I want to click it through the JavaScript.
That website is a hot mess of different systems, but they use Vue.
So what you are looking for is:
document.querySelector(".se-pagination-button.se-pagination-button--next").__vue__._events.tap[0]()
First, Thank you for watching this question!
I'm newbie to angularJS and i'm trying to make pagination to be more flexible to use.
Below is my situation.
I made pagination function
It works as my intention
But, When i get into other page(leave list page which includes pagination function), and try to go back, the problem appears!
(Here is what i want to solve) I go back to list page by clicking backspace key or clicking back button on view. and the params i entered in list page is gone!
In multi page application, the url can be '/tt?aid=11&bid=22&cid=33', and i get into detail view page, and i can retrieve to '/tt?aid=11&bid=22&cid=33' by just clicking back button. but in angularjs, it goes back to list page with no params.
And below is what i tried to solve above problem.
I used local-storage-service
I used onPageUnload event(of browser)
I'm not sure if this best fits.
Store the page no.
When you click back to get that list, feed that page no.
page no can be stored in a scope variable.
Your pagination function should be able to give the list based on page no.
A co-worker took this url: https://www.rbi.org.in/Scripts/BS_PressReleaseDisplay.aspx which has month/year pagination via Javascript (see the elements on the right) and was able to give me this url:
https://www.rbi.org.in/Scripts/BS_PressReleaseDisplay.aspx?__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=%2FwEPDwUKMTg0MTg0MzQ2NmRk1lDKkbV9IbwhES0FyX%2BlSLhp%2FzA%3D&__VIEWSTATEGENERATOR=380F4D6F&__EVENTVALIDATION=%2FwEdAAiUUGGuo52vbcR6TOSGc2%2FnlK%2BXrsQEVyjeDxQ0A4GYXFBwzdjZXczwplb2HKGyLlqLrBfuDtX7nV3nL%2B5njT0xZDpy7WJnvc3tgXY08CYLJD%2BrfdwJAuBoVBISURIXWlx9xf1loRXvygROM%2FA1O%2BNHJounKCGGAHd04zzVhBPZz4BK5Wx46wqhV0iQkxGw1Nhr9A6c&hdnYear=2016&hdnMonth=12&UsrFontCntr%24txtSearch=&UsrFontCntr%24btn=
where I can replace the year after hdnYear and the month after hdnMonth with any year and month, and it will bring me directly to that page. I asked him how he did it, and he said "I used the Network tab in Chrome dev tools." That's about all I could get out of him.
Does anyone know exactly how this is done? For example, I'm now trying to discover similar way to get the actual url for each page of this site: http://www.ojk.go.id/id/regulasi/otoritas-jasa-keuangan/peraturan-dan-keputusan-dewan-komisioner/Default.aspx by looking at the Network tab as I change pages. There is nothing I can see in there that's similar to the above example.
This is how it was done for the rbi.org.in URL you've mentioned
Open Chrome and go to the URL you've given
Right click on the page and select Inspect
Click on the Network tab.
Click on one of the year/month links on the website (the pagination you referred to)
In the Network tab, you'll see a list of GET/POST requests being made by the client (ie, the browser) to the server.
In the Filter box (on the top-left of the Network tab), type in the search filter method:POST.
Click on the entry in the Name column. This will open up more details about the POST request. Scroll down to the section titled Form Data.
Click on the view encoded button in the Form Data section
These are the parameters your friend included in the URL. You'll notice hdnYear and hdnMonth also listed in there. The URL your friend gave can be obtained by clicking on view source
Well I can't really tell you how to exactly reproduce this in the site you're trying to, but I can tell you what your co-worker did.
In the page https://www.rbi.org.in/Scripts/BS_PressReleaseDisplay.aspx:
Open the network tab in dev tools, clean the log if theres anything there.
Click on a year and month
On the network log search for BS_PressReleaseDisplay.aspx in the "Name" column and click on it
Inside the Headers tab go to "Form Data" and click on "view source"
And thats it, theres is the URL parameters that your coworker gave you, you can try doing this on the site you want to reproduce it clicking on another page and searching for Default.aspx, but you'll have to figure out what does each parameter means to find which one is the page number or whatever you're looking for (check it in the parsed view for easier reading).
Screenshots:
http://prnt.sc/emsl2w
http://prnt.sc/emsm2z
Hope this helps you.
The URL he sent you, has URL parameters/query-strings that, is read by the server which then sends you the selected pages.
So basically the servers pics up the request and reads these paramters which then most likely is parsed into a method of some sort, querying a database then returning the result for you.
If your the owner of the linked website, you can implement such solution, otherwise you´re stuck since it requires coding on the backend.
To go back to the appropriate tumblr page, we're using:
Back
However, we're getting a lot of traffic directly from the twitter app, and this stops the function working. Is there a way so that if the history.go doesn't work (or takes you outside the site), it will just take you to index.html?
This is one of the pages the history button is on: http://lexican.info/post/49265445109/sesquipedalophobia
Thanks for any help at all.
Sadly I don't think this is possible as there is no relationship between a post and what page of the index the post is displayed on.
Try to check how many page in the history list with history.length:
http://www.w3schools.com/jsref/prop_his_length.asp