Issue "prerender" 'on the fly'? - prerender

Is it possible to issue a prerender statement 'on the fly'? e.g. I use jQuery to insert this in
<link rel="prerender" href="www.example.com" />
into the and it will execute? Is there a way to re-issue it x times?
Basically, when someone adds something to the shopping cart I want to prerender the checkout page, but obviously I can't do that at page load because it will prerender the checkout page without the new item added.
Thanks

Yes, it is possible to use JS for adding the prerender hint and you can update the url to a page which should be prerendered. Basically, the browser will "forget" the previously prerendered page and prerender a new one. But, you have to be careful, if the browser doesn't have enough time to prerender the checkout page, the user will see the stale checkout page.
Considering your case, you will need to use a query parameter, otherwise, the browser won't prerender the checkout page again after updating the href attribute, because it is already in the cache. For example, urls might look like:
/checkout?timestamp=111111
/checkout?timestamp=222222
/checkout?timestamp=333333
The user must visit the page with the latest query parameter (/checkout?timestamp=333333), otherwise, the browser will normally load the checkout page.

Related

GTM - History Change Trigger not tracking Initial PageLoad

I am using History Change trigger in my GTM TAG to track my page views since mine in Single Page Application(Angular 6). I could see all the page views and its related data are tracked except Initial page load i.e., HomePage.
If I do refresh my home page it is getting tracked.
Do I need to use different trigger to capture initial page load or Am I missing something here?
Any reference link would be helpful.
You can add the "all page" trigger to the GTM tag and it will trigger on both history change and page load.

Google tag manager single page application window load and history change

I'm trying to create page view tags. I have to create two for two different triggers.
Page view triggered by history change;
Page view triggered on window load (because first page load doesn't have any history change)
My problem is the home page, which is firing both tags.
Because if put in URL www.mysite.com, the page redirects to my.site.com/home
which creates a window load and a history change. So two page view tags are fired.
I can't exclude historychange trigger to exclude page path: /home because once people got into the site they'll navigate back and forth.
I can't exclude windowload because people may use either URL to enter the site (mysite.com or mystie.com/home)
Anyone can help me with this?
I suggest to create 1 page view tag instead of 2 and use both triggers. Multiple triggers in GTM tag work with OR operator. And set tag to fire once per page.
Advanced settings -> Tag firing options -> Once per page
UPD I'm afraid that in this case other hits for virtual pages triggered by History change will not be fired (because of 1 per page rule). Try to check what value have variable Old History Change after redirection. If undefined or empty, you can use it in trigger of History Change tag as exclusion.

Ajax enabled search for products with multiple criteria

want to have search functionality as on this website
http://www.carwale.com/new/search.aspx#budget=6&budget=8&fuel=2
here whenever the user filters search(checks any checkbox), it updates results accordingly,
that can be understood as an ajax filter.
But at the same time, the query string also reflects for the change,
which helps the user to bookmark the filter search for later reference.
changing it through asp.net/javascript may cause the page to reload..
any hint or suggestions on implementing the same would be really helpful..
This can be done with the help of 3 things together
1) as #Aristos said, checkboxes with Auto Postback enabled
2) Ajax control toolkit Modalpopup, which gets fired automatically on every async postback (http://weblogs.asp.net/ruslan/pages/ajax-update-progress-updateprogress-in-ajax-modal-popup-modalpopupextender.aspx or http://mattberseth.com/blog/2007/07/modalpopup_as_an_ajax_progress.html)
3) History Points (http://msdn.microsoft.com/en-us/library/cc488548.aspx)
This can be done completely without the use of jQuery, if you dont want to use it.
-- For the first part, he have a set of check boxes list with autopostback.
In every post back the list is updated base on the selected check box.
All is simple until now, the cool is that is have a nice interactive interface (made with javascript and jQuery).
-- About the second part, how its change the url so can be bookmark with out reload the page. The trick here is that is place the parameters after the anchor # eg:
/new/search.aspx#budget=2
Using the anchor # the page is not reload and stay as it is. So when some one click on the check boxes, via javascript is also update the url, but only what is after the # so the page stay as is with out fully reload.
Now the parameters after the # can not read on code behind but only via javascript.
So when you have bookmark this page and you go direct to eg /new/search.aspx#budget=2 the javascript reads what is after the # and translate it to commands, check the appropriate checkboxes, and ask for refresh the content. All that can be done only via javascript.
I see that is use the jQuery history plugin as helper with this schema.
http://archive.plugins.jquery.com/project/history
The same trick with parameters after # is done from amazon, when you navigate on catalog, from page to page.
-- One more clever trick that is done is that is open a full page wait, so the user can not interact with the page until the page is ready again. If it not do that, and the user make very fast two clicks on the check boxes, then this can cause a full page post back on updatepanel and this can lose the previous settings.

Getting Lightbox to Appear over Referring Page

I am working in ASP.NET (framework 2.0) with Master Pages.
I have a page that requires registration and then the user gets kicked back to the referring page.
I need to figure out how to provide a success lightbox that appears over the referring page, not the registration page (the event is fired on form submit).
I have the inline stuff in the master page and the scripts and everything fires just fine but the form is refreshed with the new (referring) page and the DIV gets hidden again.
Is sessions the only way to go here? Is there a way of having one lightbox appearing from the master page regardless of what the sub-pages are doing?
Thanks.
There should be a successful registration event. Can you emit some javascript in that scenario that would cause a redirection to the referring page. You could pass a parameter which would indicate that a light box should show up. I don't think you can redirect directly from successful registration because I am guessing that some cookie would need to be set- which the framework should handle. I might be off, but that is where I would start. I would try and avoid Session if possible.

Partial Posts in asp.net

I am working on asp.net. and i want to implement partial posts in my application. my situation is like that
i dont want to url changed in address bar and even page should not refreshed at all.
for that i used script manager and update panel but still page refreshes and url also changes.
so any one have idea about it what to do?
Thank you
If you are using Update panel and still your page is getting post back in that case check that EnablePartialRendering should be true. If this is not the case then check your configuration and all the handlers as registered properly for AJAX.
I will suggest you to use jQuery instead of update panel for partial page post back. Do a google and you will find lot of example on this.
Check this ASP.NET postback with jQuery?

Resources