How to detect HTTP UA for a hyperlink from powerpoint - http

Quick help .. i have a website which is not designed for IE hence i have written php code to read the http ua string to check if it "msie" string exists and redirecting to another page which shows the appropriate message. The trouble with this approach is that when i click the link from MS powepoint 2007 the page redirects to another page though my default browser is Chrome..
I figured that UA is getting set as "mozilla/4.0 (compatible; msie 7.0;" when i click the hyperlink from powerpoint. Is there any other field which can be used to judge that the request is coming from Powerpoint
36 minutes ago · Like

A really annoying bug in PowerPoint. A possible workaround is creating an empty page that contains a meta redirect to the URL you want to redirect to. Just dynamically replace the url you want to redirect to each time you go to this redirect page:
<!DOCTYPE html>
<html>
<head>
<title>Redirecting...</title>
<meta http-equiv="refresh" content="0; URL=**MYREDIRECTURL**" />
</head>
<body>
<div>
Redirecting...
</div>
</body>
</html>

Related

Check dynamic web page is modified

I want to check if page https://m.nn.ru/f/1238 has been updated periodically.
I ran
curl https://m.nn.ru/f/1238 | head -c 4096
And it's output is below:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="1;url=https://passport.ngs.ru/check/?name=ngs_token&return=http%3A%2F%2Fm.nn.ru%2Ff%2F1238" />
<title>Redirecting to https://passport.ngs.ru/check/?name=ngs_token&return=http%3A%2F%2Fm.nn.ru%2Ff%2F1238</title>
</head>
<body>
Redirecting to https://passport.ngs.ru/check/?name=ngs_token&return=http%3A%2F%2Fm.nn.ru%2Ff%2F1238.
</body>
</html>
So I am redirected to login page and brought back to m.nn.ru/f/1238
When I open m.nn.ru/f/1238 in browser it doesn't show the redirection link but the contents of m.nn.ru/f/1238 (though I am not logged in and I think there are no cookies set)
How to get the contents of https://m.nn.ru/f/1238 ?
Another alternative is to use https://nn.ru/community/hobby/advance which has a 301 redirect
I found a workaround. I installed elinks text-mode browser and save the page:
elinks https://m.nn.ru/f/1238 > 1

How to Properly Setup an Exit/Panic Button with Multiple Redirects

I have a site that that I've built that is for a Women's Shelter, and it requires the 'exit button' or 'panic button'.. many sites just exit you to Google or another friendly site.. I see a few questions on here that solve the problem in one way or another, but this one my client is most interested in:
http://www.ncadv.org/
Can someone tell me how they're doing this? When you click on the 'safety exit' button, it redirects a BUNCH of times to different sites (thus filling the history quickly with other friendly sites).. I really like this approach, I just can't figure how they're doing it. Any ideas? I'd thought originally they were directing to sites that have their own redirect pages set up, but if you copy the initial link in a new window, it only redirects one time.
Probably via HTTP Referer. To test, run the following in command line:
curl --header "Referer: http://www.ncadv.org/" http://abconlinenews.info/localnews.php
The link, http://abconlinenews.info/localnews.php is the first outgoing link on the button.
The response (when passed an HTTP referer with ncadv.org) is:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<title>ABCNews.com: Daily News, Breaking News and Video Broadcasts - ABC News</title>
<script>
function trigger() {
setTimeout("setPage();",20);
}
function setPage() {
window.location="/localnewstoday.php";
}
</script>
</head>
<body onload="trigger();">
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>Apache/2.2.16 (Debian) Server at http://abconlinenews.info Port 80</address>
</body>
</html>
From there, it's probably referers and redirects all the way down ;)
One thing you might consider is using javascript to keep the history clear. If you use "location.replace('www.google.com');" for example, it will replace the current entry with the new url and there won't be a history entry to go back to.
If you used a function and passed urls to it via onClick events, you could eliminate any history from being tracked at all.

<Title> tag being split accross multiple lines when genereated from MasterPage

I have created a website in VS 2008 (C#) that is using masterpages.
In the ASPX pages that are based off the masterpage I'm using the # PAGE title directive to set the title of the genereated HTML page.
When I run the page on my development system the title displays correctly i nthe browser. However when I view the source code in the browser the tag is being broken into 3 lines.
<head><title>
My Page Title
</title>
...other meta tags...
</head>
That looks very strage to me. Is there something that I am doing wrong to cause the type of behavior? Will search engines look down on this syntax with the line breaks?
I'm expecting output like this:
<head>
<title>My Page Title</title>
...other meta tags...
</head>
I've never seen that happen before, and I've used MasterPages and Page Titles a few times in the past year.
From an SEO perspective, search engines would ignore the line break in the title and only look at the actual characters between the open and close statements.
This won't make much of a difference. You should be fine either way, and search engines are smart enough to not get confused only a new line or return. Just as long as the HTML isn't malformed, you should be alright.

It seems a browser ( or is it visual studio? ) is caching a stylesheet and thus any changes I make to

I’m using a stylesheet as part of a theme and it seems that both IE and Firefox ( or perhaps VS express edition) are caching this stylesheet, since any changes I make to a stylesheet ( such as changing attribute values etc ) aren’t reflected on the displayed page. Any idea how to prevent browser or visual studio from caching this stylesheet?
BTW – only stylesheet is cached, not the entire page
Also, when I've noticed that any changes made to a stylesheet aren’t reflected on a displayed page, I’ve switched from firefox to IE. The first time the page was loaded in IE, page was displayed as it should (reflecting all the changes I’ve made to the stylesheet), but then IE also started caching the stylesheet
thanx
If you have Firefox with the Web Developer toolbar, you can easily disable caching. You can also use Ctrl+F5 to refresh the page. Holding Ctrl tells the browser to perform a forced refresh that ignores the cache.
One option is to link to the stylesheet in a manner that doesn't allow the browser to cache it. I find this is th case when dealing with things like facebook apps and such.
<link type="text/css" rel="stylesheet" href="/styles.css?v=<%= DateTime.Now %>" />
You could try adding version numbers to your css href:
<link rel="stylesheet" type="text/css" href="path/to/stylsheet.css?v1.0.1" />
The query string (v1.0.1) doesn't affect the css as such, but if the number increments the browser reloads the stylesheet (stylesheet.css).
Having the assembly version is also a good idea:
[CB]
protected string GetAssemblyVersion()
{
// get the version object for this assembly
Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
// or do it in pieces
return v.Major + "." + v.Minor + "." + v.Build +"." + v.Revision;
}
[MARKUP]
<link href="/path/to/style.css?v=<%=GetAssemblyVersion() %>" type="text/css" rel="stylesheet" />
This guy has a script you can place in your asp pages, FWIW
You can try hitting the shift button when you click the refresh button -- this always worked for me.
As everyone said, press Ctrl+F5 to refresh the page.
If that isn't working then, is this a page you designed or is it part of a project that is shared in the group? It's possible that who ever coded it might be caching the style sheets or page every so often to reduce bandwidth spent.
You could try using meta tags to indicate that the page is appears to be expired.
For example:
<head id="Head1" runat="server">
<title></title>
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE, must-revalidate, max-age=0" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="Pragma" content="no-cache" />
</head>
I have found that these meta tags aren't always taken into consideration by browsers. IE seems to be the best at detecting that the page shouldn't be cached/the content is expired.
Otherwise, refresh the page to reload the content as has already been suggested.
-Frinny

How to force Images to be loaded all the time, ASP.NET

I am serving a .aspx that contains Images. I haven't figured out yet how to force ie7(6) to fetch the images all the time (e.g redirects).
So far, I've added the following tags on my .aspx page:
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
And still, if I click the URL Bar and hit enter or do a redirect to that same page IE won't re-fetch the images.
What am I missing?
Other Notes:
ISS 5
IE7 7.0.5730.13
Works on Firefox and everywhere else but IE
Redirect Code:
Response.Redirect("url...", true);
You might just put a unique tag on the end of your image URLs to make sure the cache isn't hit. For example
<img src="/path/to/image.jpg?<%=DateTime.Now.Ticks.ToString()%>" />
Granted, if you're using WebForms you'll want to do it a little different, but still along those lines.
IIS is probably overriding those settings. Go into IIS Manager and find the folder where your images are located. Right-click and select Properties. Click on the HTTP Headers tab. Check the option "Enable content expiration" and "Expire immediately".
See http://www.enhanceie.com/redir/?id=httpperf for an explanation of how HTTP caching works, and how you can cache or not-cache your files.
I don't know exactly why, but we solve a similar problem adding these lines to the aspx.cs file, in the PageLoad Event:
//Turn off cache
Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
Response.Cache.SetNoStore();
It could be useful to solve your problem too
http://royriojas.blogspot.com/2009/04/dealing-with-back-button-and-secured.html

Resources