Refreshing websites and temporary connection loss - web

I want to display a refeshing external Website continously on a monitor.
The Website already contains an internal refresh (let's say every 30 seconds).
The Problem that appears right now is that in case of any connection loss the website tries to reload himself but will end up in a "connection has timed out state" and will no longer refresh. (because it's locked out).
What is the simplest way to avoid this "deadlock"?
I've already thought about having a Local Webpage that refreshs after a certain time, but this would cause a double refresh because the Webpage itself already refreshes every "n seconds".

Try the following:
<!doctype html>
<head><title>Insert Title Here</title></head>
<body style="margin:0;padding:0;width:100%;height:100%;">
<iframe style="margin:0;padding:0;border:0;width:100%;height:100%;" src="http://www.example.com"></iframe>
<script>
var iframe = document.getElementsByTagName('iframe')[0];
setInterval(function(){
iframe.src = iframe.src;
}, 5000);
</script>
</body>
Set the 5000 to n-1 seconds in milliseconds. (e.g., if n=30, use 29000)
Fiddle: http://jsfiddle.net/WdbNN/

Related

How can I redirect to custom pages when a user click New/Edit/Display in a SharePoint list

We are replacing the forms for our lists with forms built with SPFx. Building and deploying the form is no issue. The problem is redirecting the form controls to this form (when a user opens an item or clicks new, etc...). Is there a recommended method of accomplishing this? I have been successful using two methods but they both seem volatile and hacky.
The first being replacing the entire form code using SharePoint designer. For instance, the new form code would be
<%# Page language="C#" %>
<html lang="en">
<head>
<script type="text/javascript">
const list = window.location.href;
const site = list.substring(0,list.toLowerCase().indexOf('/lists/'));
window.location.replace(site + "/SitePages/MyListForm.aspx");
</script>
</head>
<body>
</body>
</html>
This works sometimes... Upon saving, the form code seems to regenerate the form code but the redirect still works. However, if I open and save the code again, everything breaks and the list action goes back to default (clicking new would now show the 'New Item' call out instead of directing to the form).
The other method is opening the new/edit/display form in the browser, with ?toolpaneview=2 which allows me to add a script web part to the page (although it doesnt like to save) and add the script redirect in.
<script type="text/javascript">
const list = window.location.href;
const site = list.substring(0,list.toLowerCase().indexOf('/lists/'));
window.location.replace(site + "/SitePages/MyListForm.aspx");
</script>
this seems to be less volatile than the first method, but it still seems hacky. If I delete the original form web part, the form breaks and the list actions again revert to default. Editing the script requires visiting the form with ?contents=1 to delete the script web part and then I have to re-add it again using the toolpaneview method. In order to even save the web part change I have to click "Edit Web Part", which in turn saves it. There is no simple "Save" action which again makes me feel like this method is not intended to be done.
Is there any recommended way to accomplish these redirects? I've found plenty or tutorials online about setting up the list form, but nothing about this essential step.

introduction for a website

I want to know how to make introduction page which lasts couple seconds and then takes you to the home page of website. That is, when someone types my domain name I need a page to introduce to subject of my website.
This would be what you could use to redirect the site, change the content to the amount of seconds you want the viewer to stay on the page.
<meta http-equiv="refresh" content="0; url=http://whatever.org/">
Referenced from HERE
you can do this in 2 ways,
create a pop up and use javascript setTimeOut() for delay
make index page as your subject of the website and use setTimeOut() for delay and then reidrect to your home page.
You could also use javascript to redirect. This example redirects the page after 2 seconds:
<script type="text/javascript">
function foo()
{
window.location = "http://www.google.com/";
}
setTimeout(foo, 2000);
</script>

delay "creation" of div, not just showing of div

I may not be using the proper terminology but hopefully I get my question across properly. What I'm wondering is if it's possible to "delay" the "creation" of a specific div, rather than just delay the FadeTo or Show jquery command.
I ask because I'm using the Vimeo API which is completely mind-boggling and frustrating (at least for me - it's a source of endless shame and I wallow in self-pity when attempting any such Vimeo API coding). What I'm trying to do is just delay the autoplay of the iframe code for an embedded Vimeo video. The problem is that I have the div containing the vimeo iframe set to hide for a good three seconds after the page loads before it fades in, but since it's just hidden the video starts playing anyway before the visitor can actually see it. I'm just using &autoplay=1 for the vimeo embed...
So, I suppose the only other solution besides getting this confusing Vimeo API to try to delay the video that way is to be able to just use a jQuery command to delay the vimeo iframe from even loading/being created on the page, until the container div fades in.
If this is possible I will bless my lucky charms. And double points if someone answers in the next few hours! Thanks so much!!!
I just editted my answer and applied it to fit your code you provided:
So what I did here is: 1) load jquery into your page2)when jquery sees your div with id="div" as 'ready', it will fire an alert that says loaded (you can remove this it was just for testing purposes), and then delay the src from loading in your iframe for 2 seconds (2000 miliseconds)
3) So you can change the 2000 to whatever time you want, and make sure the "player_1" matches your iframes id
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(document.getElementById('div')).ready(function()
{
alert('loaded');
setTimeout('document.getElementById("player_1").src="http://www.youtube.com/v/82CYNj7noic?autoplay=1"', 2000);
});
</script>
<div id="div" class="div">
<iframe class="iframe" id="player_1" > </iframe>
</div>
​
​
Does this work for you?? I hope I've helped!!

Adding <meta> redirect using Greasemonkey

I'm looking to add <meta> element to specific websites using Greasemonkey script. The idea is to redirect the website to another page after X minutes. Something like below:
<META HTTP-EQUIV="Refresh" CONTENT="60; URL=http://example.com">
What is the simplest way to get this done?
You can use Greasemonkey (or JavaScript) to add the meta node, but it won't be parsed (at least in FF 4.0). AFAIK, browsers are only expected to parse meta directives on initial load.
You can use JavaScript to "redirect" the page, after an interval, like so:
setTimeout (function() {
window.location.href = "http://example.com";
},
60000 //-- 60 seconds
);
If you don't want the original page to remain in the browser's history, use:
setTimeout (function() {
window.location.replace ("http://example.com");
},
60000 //-- 60 seconds
);

DD_belatedPNG images disappear after document ready

I'm using DD_belatedPNG to fix transparent PNGs in IE6; at a certain point I noticed that all fixed PNGs started disappearing a second after the document loaded. Something along these lines: page loads, 1 second passes, the transparency becomes viewable and the PNGs almost immediately disappear. Any clue on what the cause is and how to fix? Thanks!
UPDATE: the elements are still in place, so if one of the PNGs was a link, it is still clickable.
<script src="/scripts/plugins/DD_belatedPNG_0.0.7a-min.js"></script>
<script>
PNG_selectors = ".bbb, #logo, #home_title, .home-image, ..........";
alert("PNGs are going to disappear now");
DD_belatedPNG.fix(PNG_selectors);
</script>
As long as the alert is in place they are there, once OK is clicked, they are gone.
For those who are interested, this was being caused by as script loading stuff from fonts.com... I set it to defer, and it fixed the issue. Sweet!
Can you try calling DD_belatedPNG.fix() only when the page has finished loading, then see if the problem goes away? Attach an event handler to window.onload like so:
<script>
window.onload = function() {
var PNG_selectors = ".bbb, #logo, #home_title, .home-image, ..........";
alert("PNGs are going to disappear now");
DD_belatedPNG.fix(PNG_selectors);
};
</script>

Resources