Session Variables Issue in IE8 and Classic ASP - html

So I have a website featuring a stock management system, this contains a table that displays various stock and inventory information.
When an "images" link is clicked, the Session variable for images is switched between "show" and "hide" and the page is then reloaded with the updated variable and either showing or hidden images for each product.
This works perfectly in Chrome, Firefox and Opera (all tested thoroughly) but does not work at all in IE8.
Normally I would blame my code but clearly this is a pure browser compatibility issue which is really throwing me as i didn't realise ASP and VBScript really needed to be altered to work on different browsers.
I have attached the code that toggles the session variable below anyway but I doubt it is linked to the issue.
images = Request.QueryString("images")
If images <> "" Then
If images = "show" Then
Session("images") = "Show"
ElseIf images = "hide" Then
Session("images") = "Hide"
End If
End If
An example of the problem goes as follows:
I display some items and click "hide images", the images then hide..
I then reload the page and the images are showing again and the Session variable has changed back to "show" despite there being NOWHERE in the code that specifies to return back to the previous value (checked with Ctrl + F for keyword "images")
Has anyone else encountered a similar problem where Session variables act in unusual ways specifically in IE, or can suggest a solution?
Thanks, Josh

Many thanks, Josh - here you go.
You can use the Server.URLEncode() (classicasp.aspfaq.com/general/…) method to counter this problem.

The server side code of Classic ASP is browser independent. What's more likely to be a problem is the way you make the section show or hide.
Check your code and pay special attention to the method you've used to actually do the showing and hiding. Check out the styles for the block that contains your product using the developer tools in IE8.

After further research I have found why my page is not working correctly via a Microsoft support page.
http://support.microsoft.com/kb/316112
The fact that my page URL had an underscore in it caused Session variables and Cookies to not be saved.
Hope this helps others in the future
Josh

Are you trying to retrieve/show session values within same page that you are assigning session values? I'm asking just to be sure because it takes one round trip to the server to save those session values.

Related

Chrome caching page when pressing previous button

i have a page that displays a list with vuejs, the user can do some update on this list (filters). Whenever he go to another page and then click the back button on the browser, there are still the old parameters (filters), he needs tu press refresh to get it right.
These information are sent from the PHP controller, and are corrects.
Is there a way to prevent browser caching ? i found other topics on the same problem, but no answer was really fine (mostly force page reload, which is not really fine for UX)
do you know any better solution ?
Try deleting the cookies and local storage objects, should work see here:
Clearing localStorage in javascript?

Use window.name to open links in emails in the same tab

I am developing a web site where users can change settings which they have to confirm before taking effect.
The confirmation is done by a link I send them via E-Mail. In the HTML of the website I use this little snippet:
<script type="text/javascript">window.name="mysite";</script>
And in the HTML emails I use
Click me
But Chrome is always opening new tabs instead of opening them all in one.
Is this even possible or is it forbidden for some reasons?
Webmail platforms such as Gmail tend to modify some of the HTML code of an email due to security reasons.
They obviously remove any javascript code the email could have. But they also change (or add if none) the target property of every anchor element and set them to target="_blank" in order to avoid the user to be taken out of Gmail (in this case).
Unfortunately every webmail platform has their own behavior, therefore, what you want to do is not gonna work on every webmail platform.
If what you want to do is prevent the user from having multiple tabs of the same page opened, (*please refer to Update 1) it comes to mind you could use web sockets to close the previous tab once the user enters in the URL sent by email. Have a look at socket.io for example.
Update 1
There's no way to do this using WebSockets. There's no possible way to close a window that wasn't opened using javascript, and it can only be closed by it's parents.
That is a very interesting idea. I like it. Alas, it appears that, in modern browsers, you can no longer close a window you didn't open through javascript. So if you aren't allowed to run javascript in the email, the best you can do is to redirect the original page to a "thank you" page and leave it hanging around in the browser's tab (but no longer waiting on conformation). Like this:
PleaseConfirm.html:
window.name="need_redirected";
Confirm.html:
var w = window.open("", "need_redirected");
if (w)
w.location="ThankYou.html";
Of course, for old IE, I'd still try to close the old window in ThankYou.html:
window.top.close();
You can still try to set the target, of course, just in case it works, and you can always try putting an onclick attribute on your tag for the same reason:
click here
But that seems to be the best you can do. Bummer.
Neither of the other two answers work, but this one probably will:
In the initial tab, listen for an onstorage event, with a certain key being created, e.g. "userHasConfirmedEmail". When the event occurs, window.top.close().
In the new tab, create that key.
Credit goes to Tomas and his answer.

Freeze column headers in browser while scrolling

I am trying to freeze all column headers in a report when scrolling down. I have read numerous articles about how to go to Advanced Mode, select the header and set FixedData to True, KeepWithGroup to After, RepeatOnNewPage to True. That works when previewing a report, but it does not work in a browser. I have tried using IE 11, Chrome, and other browsers, but none of them fix the column headers while scrolling.
I have spent hours trying to get this to work and have read articles such as:
Freeze column header while scrolling
and
Freezing column headers while scrolling in SSRS, but none of them accomplish this in a browser.
I tried creating a simple table report from the report wizard and following these instructions, but it still does not work. This is very critical to get working in order to use SSRS. I am using SSRS 2012. Any help would be greatly appreciated.
It's crucial to select the correct "Static" member before setting those properties. For your scenario I think you want the Static member within the Row Groups list.
If there are several "Static" members, select them in turn and note where the selection box moves to in your tablix - this can help pick the right one - usually the last.
My favourite post on this is from Robert B:
http://blogs.msdn.com/b/robertbruckner/archive/2008/10/13/repeat-header-and-visible-fixed-header-table.aspx
Good luck - this is still such an unbeleivable mess after 5 years and 3 releases ...
This is a crazy idea, but instead of using the Report Viewer, could you render the report to HTML and add it to a web page that has a CSS class that will change the header to position:fixed;?
It appears fixed headers simply do not work in the ASP.NET Report Viewer control. I have a simple aspx page with the ReportViewer control on it, testing it in IE 11. The fixed headers work in the Preview and Report Manager, but not the ASP.NET Report Viewer control.
Therefore, I decided to simply show my reports using the built-in Report Viewer instead. Fixed column headers work that way.
I just spent a couple of days investigating this exact issue. Worked in preview, didn’t when deployed. I had noticed my fixed columns stopped working a few years ago.
My break through was when I started testing using a fresh SSRS 2012 install the freezing rows and columns worked perfectly. By comparing the differences between that and my live system I found the issue was changes made to ReportingServices.js to fix blank reports showing in Chrome.
Forcing el.style.overflow = "visible" instead of its default of “auto” breaks the freezing in IE. Our web developer changed the if statement so it doesn’t do the replace for IE by checking a non IE function exists (window.addEventListener).
if (el && window.addEventListener)
el.style.overflow = "visible";
So the complete code added to a fresh ReportingServices.js is the following
function pageLoad() {
el = document.getElementById("ctl32_ctl09"),
//Fix Chrome invisible report
if (el && window.addEventListener)
el.style.overflow = "visible";
}
if (window.addEventListener) {
window.addEventListener('load', pageLoad, false);
} else {
window.attachEvent('onload', pageLoad);
}
C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportManager\js\ ReportingServices.js
I was able to get my column headings to freeze in IE 9. IE 11 was having issues. IE 11 also did not display vertical and horizontal scrollbars
The Solution (for me) was to put IE 11 to compatibility mode.
Instructions to use compatibility mode.
1) Right click the top of the window and then choose to show the "menu bar"
2) in the menu click tools
3) Click "Compatibility View" to add the current web url to the list of pages to show in the compatibility view, this list can be managed by rather clicking "Compatibility View settings"
Hope this helps.. I could not find this documented elsewhere.

Chrome Extension - Don't load certain parts of a webpage

A recurring problem with modern web design can be summed up as "too much sh** all over the place". There're two problems with this: one, it takes up memory and takes longer to load, and two, it visually clutters the webpage.
If I just wanted to solve the second problem, I wouldn't need help. JavaScript can delete DOM nodes and CSS can hide them, so there're already a few visible ways to simply hide parts of a webpage. What I want to do is solve the first problem - make a webpage load faster by not loading certain elements.
I'm pretty sure it's impossible to selectively download certain parts of an HTML file. But once the source is downloaded, the browser doesn't have to actually parse and display all of it, does it?
Of course, if this is done after it's already been parsed and displayed, it would be pointless. So I need a way to tell Chrome what to do before it begins parsing the HTML. Is this possible, and do you think it would significantly reduce load time/memory usage?
Yeah, unfortunately Ive never seen a way of changing the html before Chrome renders it.
But as far as blocking things that that page gets to display then Id recommend just using AdBlock https://chrome.google.com/webstore/detail/gighmmpiobklfepjocnamgkkbiglidom
AdBlock can be used to stop resources (js,images,css,xmlhttprequest) from ever being downloaded (it blocks them in the background using the webRequest api) and can also hide elements using css...its rather effective (just remember to select advanced options in its option page and then when you click the AdBlock button you get "Show the resource list"). Also installing Flashblock can help...or disable plugins in Chromes settings, doing this will make them not load but will still show on the page and then you can make them load.
Totally possible! Meet the newest Chrome API: webRequest, finalized in the current version of Chrome - 17.
Docs for webRequest: http://code.google.com/chrome/extensions/webRequest.html#event-onBeforeRequest
I'm trying to think of a solid way to do this... one suggestion I have is using the 'sub_frame' filter, and watching if it's a like/tweet/social button url
You could also block known analytics stuff... and the list goes on! Have fun! Do you have an email list I can sub to for when you launch? If not, get one and drop me a comment!
(From the comments, here is how a innerHTML hack could work)
//This modLoop constantly peers into and modifies the innerHTML in attempt to modify the html before it's fully processed.
var modLoop = function modLoop(){
var html = document.documentElement.innerHTML
//modify the page html before it's processed!
//like: html = html.replace('//google'sCDN.com/jquery/1.7.1/', chrome.extension.getURL('localjQuery.1.7.1.js'));
//I just pulled that ^ out of nowhere, you'll want to put careful thought into it.
//Then, mod the innerHTML:
document.documentElement.innerHTML = html;
setTimeout(modLoop, 1);
};
var starter = function starter(){
if (document.documentElement.innerHTML && document.documentElement.innerHTML.lengh > 0) {
modLoop();
} else {
setTimeout(starter, 1);
}
};
starter();

results are appended into iframe every invocation

I have an iframe that displays thumbnail images from Flickr in my web application. The problem, I see is when I reload the page, sometimes, I see the same set of images being appended to the earlier set of images. So I get two sets of every image and on a subsequent reload, I get 3 sets of images.
The images are part of a form. So I see multiple submit and cancel buttons as well. Any suggestions on what might be causing this and how I can avoid this from happening?
Pardon my ignorance. I was not resetting my server side variable after the fetch and hence I was seeing the above weirdness. Firebug helped me debug this.