Web Page Redirect and Block Return - redirect

I'm using a simple (Meta) timed redirect on a web page. The viewer may wait the allotted time or click on a link to leave the page. I would like to block the viewer's ability to return to the original page after leaving it.
I've been cautioned about using Meta scripts due to the possibility of search engine rejection- true or not, I haven't a clue.
If possible, I would like to avoid Java or the use of cookies. Nonetheless, if Java is the best or only solution, I am open to it.
Your thoughts and guidance are greatly appreciated.
Thanks.

You can try something like this:
<script>
function preventBack(){window.history.forward();}
setTimeout("preventBack()", 0);
window.onunload=function(){null};
</script>
You can place that code on the page that you don't want the user accessing using the back button in the head section. But, it is not recommended since it might annoy your users.
This post explains things in a bit more detail from multiple users.

Related

How to make a website that redirects to a random link on a list?

I'm wanting to know how to make a redirect a simple way.
I know nothing about code (Sorry for my ignorance) but I want to learn.
So I want to make a website that only redirects, so when someone opens it will get redirected to another website.
The tricky thing here is that I want the website to select a random link in a list I will provide, so I thought I could do it on a free website creator (wix.com) and I wanted to know if someone could help me do the code for me.
Thank you a lot.
You will need Javascript and HTML for do this.
HTML just do static things, so you will need create a list with Javascript and then modify the link on html page.
Just add this to the Head on your HTML file:
<script>
window.location.replace('http://www.reddit.com')
</script>
That will redirect to Reddit as soon as you open your html file.
I recommend that you use the "IF / Else" or "for" function to redirect to different websites each time you open your web page, because you said that you are learning, so go slow. Just study Javascript or Dart and you can do whatever you want on your site.

In ColdFusion, how to I remove the text at the end of my URL?

Sometimes, links open pages in my website with weird text at the end of it (like Facebook). I would like to remove that text, since my page will not display with it there.
For example, what I would like to do is tell my page that if the URL has text after a pound sign, remove it and open the URL without it.
So if someone opens my page with:
http://www.example.com/news/stories/this-is-a-news-story/#sthash.MmwTdqVa.dpuf
I want it to correct and open the page
http://www.example.com/news/stories/this-is-a-news-story/
How would I do that? I know how to do this with PHP, but I'm new to ColdFusion.
Thanks!
Brendan
Are you using a service like AddThis.com? If so, these (and other) marketing services may add fragment to URLs for tracking purposes. They're harmless, but here's AddThis instructions on how to remove them if you use their service. (Check w/your marketing team before you do this.)
http://www.addthis.com/academy/removing-hashtags-anchors-and-tracking-codes-from-your-urls/
The fragment is not passed to the ColdFusion server and not in the CGI scope. It's intended to be available and used in the client browser only. This should not be causing any problems with "ColdFusion" generating pages, so your problem may due to javascript. Open up Web Developer tools (F12) to identify any javascript errors that may be caused by the unexpected fragment. (You didn't provide a URL or error message, so it's difficult to troubleshoot the problem you may be encountering.)
Here's an existing solution on StackOverflow that you could you use to remove the fragment client-side:
https://stackoverflow.com/a/13824103/693068
// remove fragment as much as it can go without adding an entry in browser history:
window.location.replace("#");
// slice off the remaining '#' in HTML5:
if (typeof window.history.replaceState == 'function') {
history.replaceState({}, '', window.location.href.slice(0, -1));
}
I would only advise performing this once during pageload and maybe include a filter to preserve any fragments you actually want to preserve.
As a side note, I occasionally add Go to Top to long pages without any matching #top element. Normally any id that is not found will force the browser to automatically scroll to the top.

How to secure querystring/POST details to a third party

I'm basically looking at a security problem between a parent page and an iframe with links to a third party.
I want to send a POST or a GET (doesn't matter which as I can control the other side) to the third party, but not expose any details within it (say a SID or a user token) and have it's HTML content (JS/HTML/Images) loaded into the iframe.
I've looked at server-side redirects, creating a proxy using webclinet/webresponse and am curious to whether there is a good way to do it.
Has anyone ever done this before, or think that the secrity is not possible? Hell, even if I'm barking up the wrong tree on how to solve this.
If anybody has any examples on this it would be greatly appreciated.
Cheers,
Jamie
[Edit] Was thinking I might need to add some more details.
Say I have a parent page: https://mycompany.com/ShowThirdParty.
This has an iframe in it at the moment which will have the content of another component (also owned by me, or another team more specifically)
Basically I'd like to send some credentials to content in the iframe in such a way that the external pages can't read it, the iframe is put into a modal (I've done that) and the iframe has the restricted content with the auhtentication almost seamless and invisible.
I currently have it working as a GET url generated dynamically via JS and then passed into the iframe src parameter, obviously that isn't secure.
I kind of want some kind of server side redirect across a full url, but I don't even think that's possible.
You could try using AJAX and load a PHP script (with any parameters to the script encoded/encrypted) to query the 3rd party page and load the response into the iframe. Not really sure how your code is setup but there should be a way.
It can also be done by POST Method (submit the data to iFrame using POST) as it is HTTPS so the data you send to iFrame is encryped.

Facebook fan page canvas source?

Im trying to understand how to learn reading the source of a facebook fan page. So far, I can only get the layout displayed while viewing the source.
Here is an example: If you go here:
http://www.facebook.com/pages/See-oho-nieps-YothG-RRofiLe/106340746065367#!/pages/Milton-Keynes-United-Kingdom/IF-MR-BEAN-WAS-IN-AVATAR-HE-WOULD-LOOK-LIKE-THIS/302690570115
That canvas page requires you to be a fan of the page. This is done with:
content here
My question is, why cant I find the FB:visible code in the source of that page? I would be grateful for any guidance!
I believe it's because the FBML is interpreted server side, so if it output the markup their parser would have to be Javascript based, causing a greater risk to security (?) and slowing the process down entirely.
I'm not too familiar with it though, I must be honest.

How can I pull in my BlogSpot page into a page on my web site

I have a blog on BlogSpot.com, and I have a domain based on my own name. I want to have a URL on my site (like http://www.mydomain.com/blog) that will then pull in the content from my blog page, but I want the URL in the address bar to stay on http://www.mydomain.com/blog, so that it does not look like you left my site.
(I have a Windows hosting account on 1and1.com)
I did Google this question, and I found how a few things, like:
1: Adding a tag in to "refresh". Tried this, but it changes the address bar.
<meta http-equiv="refresh" content="0; URL=http://myblog.blogspot.com" />
2: I also learned about the html iframe thing, but it has height and scrollbar issues.
3: Then, I found this partial code snippet, but I don't know what to do with it, or if it will even work against the BlogSpot server, or on my server:
<%
Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.Open "GET", "http://myblog.blogspot.com", false
objHTTP.Send
Response.Write objHTTP.ResponseText
%>
I am a client app guy, so this web stuff is all new to me.
Any help will be greatly appreciated.
The third option will probably work for the initial page load, but any links on the page will then direct the user to the BlogSpot page, and change the url. It simply fetches the page from blogspot, and then sends it to the user without any changes.
For me, the changing url is not a big deal, as long as it's easy for the user to get from one to the other easily; have prominent links on either page that tell the user where they go. Most people don't care about the url, they just care about the content.
Using an IFrame is probably your best bet. Many Facebook applications are in IFrames and still integrate very well.
I think using a regular frame or an iFrame is probably the easiest solution. What kind of scrollbar issues did you encounter? You can set custom values for some of these attributes, just check out the documentation here:
http://www.w3schools.com/TAGS/tag_iframe.asp
If you didn't want to use frames, you could actually proxy the entire page using a server side application like Squid. However, this is more difficult to setup, requires the ability to install software and configure firewall/iptable settings on your host, and must be configured properly to prevent malicious abuse.
-Mark
Here are some options you can try:
If you have PHP installed:
<?php
echo file_get_contents('http://myblog.blogspot.com'); // or you can use fopen()
?>
Or Server-Side-Includes installed:
<!--# include virtual="http://myblog.blogspot.com" -->
You can also pull blog content from Blogspot using the Blogger Data API.
The advantage of this is that you can reformat and reorganize the content to match the style of your website. The disadvantage is that it's more work than an iframe, and you probably won't match the full functionality of Blogspot.
I'm playing with this now to see whether I can use Blogspot as a type of CMS for a club news system.