|
putting this in head will
redirect IE browsers less than 6
(google 'conditional comments')
Commonly, the necessary features are
checked and the page redirected if they
are present leaving browsers which do not
have desired features at current page,
the current page will explain the problem to the user.
Users with appropriate browsers will not see the current
page because they will have been redirected.
(google 'javascript feature testing')
Also, if a necessary feature is missing from browser
there is always a javascript work-around that will
compensate, unless of course it's javascript thats missing.
In that case it will not redirect!
So leaving that browser on current page is good option.
|
|
|
|
|
location.href = 'newpage.html';
|
|
|
|
|
NeverHeardOfMe wrote: location.href = 'newpage.html';
The difference between location.href and location.replace is that location.href creates a new history entry on the visitor's browser
while location.replace replaces the history entry. If the history
entry is not replaced the back button will lead to the redirect
page again causing 'redirection loop' which is usually undesirable and may have unwanted side effects.
|
|
|
|
|
TIL... to RTFM properly! I stand corrected...
|
|
|
|
|
Hello all,
I have used the countdown timer in my asp.net project . It does working fine but the problem arises when I press f5 key or refresh in anyway..timer initialses again to maxmimum set time...
So I need a solution for countdown timer that must not be affected on refreshing the page...
Please help..........
thanks in advance
Amit Jain
|
|
|
|
|
Well, one answer is 'use frameset with timer in a frame
that doesn't get refreshed'.
|
|
|
|
|
Thanks for your reply bro..
But it doesn't work
When I refresh the whole page ...frameset automatically refreshes and time again intialises to the given time (say 10 min) and starts counting down..
Any alternative to this ??
|
|
|
|
|
blockquote class="FQ"> vinci007 wrote: Any alternative to this ??
Yes, store the start time in a cookie.
here is a very simple example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Timer Page</title>
</head>
<body>
here is a timer that will keep count<br /> even if page is refreshed<br />press button to reset<br />
<div id="timerDisplay"></div>
<div><input type="button" onclick="myTimer.reSet()" /></div>
</body>
<script type="text/jscript">
var myTimer = (function () {
var readCookie = function () {
var ca = document.cookie.split(';');
for (var i = ca.length; i--; ) {
var c = ca[i].split('name=');
if (c.length == 2) return c[1];
};
return 0;
};
if (!readCookie()) {
document.cookie = "name=" + (new Date().getTime()) + "; path=/";
};
var stuff = {};
stuff.howLong = function () {
return new Date().getTime() - readCookie()
};
stuff.reSet = function () {
document.cookie = "name=" + (new Date().getTime()) + "; path=/";
};
return stuff;
})();
setInterval("document.getElementById('timerDisplay').innerHTML = myTimer.howLong();", 500);
</script>
</html>
modified on Wednesday, August 25, 2010 9:45 PM
|
|
|
|
|
I am using querystring to execute the notepad data.
notepad contains follwing:
mailto:shail?CC=shail&Subject=test&Body=qtsts
I dont want to use window.open script in notepad file to open the prepopulated outlook window, is there anyway we can open the outlook window using above 'mailto:' data. Below is url as example
http:example.com?name=http:teamspace/sites/notepadefile.txt
below is my script
<script>
function PageQuery(q) {
if(q.length > 1) this.q = q.substring(1, q.length);
else this.q = null;
this.keyValuePairs = new Array();
if(q) {
for(var i=0; i < this.q.split("&").length; i++) {
this.keyValuePairs[i] = this.q.split("&")[i];
}
}
this.getKeyValuePairs = function() { return this.keyValuePairs; }
this.getValue = function(s) {
for(var j=0; j < this.keyValuePairs.length; j++) {
if(this.keyValuePairs[j].split("=")[0] == s)
return this.keyValuePairs[j].split("=")[1];
}
return false;
}
this.getParameters = function() {
var a = new Array(this.getLength());
for(var j=0; j < this.keyValuePairs.length; j++) {
a[j] = this.keyValuePairs[j].split("=")[0];
}
return a;
}
this.getLength = function() { return this.keyValuePairs.length; }
}
function queryString(key){
var page = new PageQuery(window.location.search);
return unescape(page.getValue(key));
}
function displayItem(key){
if(queryString(key)=='false')
{
document.write("you didn't enter a ?name=value querystring item.");
}else{
document.write(queryString(key));
}
}
</script>
modified on Thursday, August 12, 2010 8:38 AM
|
|
|
|
|
shailrathore wrote:
I am using querystring to read the notepad data.
notepad contains follwing
mailto:shail?CC=shail&Subject=test&Body=qtsts
What does it means? You are reading nodepad data in querystring??
shailrathore wrote:
I dont want to use window.open script in notepade file, is there anyway we can open the outlook window
using above 'mailto:' data. at the moment it only write the data.
http:example.com?name=http:teamspace/sites/notepadefile.txt
below is my script
Your question is not clear.
If I understand correctly that you wants to read the data from a text file and prepare the mail body, subject etc and send the email. Is it right?
|
|
|
|
|
Yes Prosanta you are right. At the moment I am using below script in notepad
window.open('mailto:shail?CC=shail&Subject=test&Body=qtsts
')
and i dont what to use this script.
Please help
Shail
|
|
|
|
|
Hi All,
Can anyone please let me know how we can find all open browsers with the help of Javascript? Please help.
Thanks a lot.
Thanks,
Rajinder
|
|
|
|
|
You cannot find all the open browsers using javascript. You can use Navigator object for getting information about vistor's browser. Check this [http://www.w3schools.com/js/js_browser.asp].
Provide more information about your requirement.
|
|
|
|
|
Hi,
Thanks for our reply.
My requirement is to close all the open pop-up windows when user click log-out or close the application parent window. The problem is that I can not change all the pages of application 'coz if I change all the pages of my application then I have to change around 1000 pages. I am trying to findout some solution which I can apply on the logout link or onunload of main window, to close all the opened pop-ups.
As we can find out the URL of browsers with "document.location.href", so I was thinking that if there is any way to find out all the open browsers and then get the URL of all the open browsers and then close all the browser whose URL starts with my domian name (let say kamboj.com).
Please help me to find out solution for this.
Thanks,
RK..
|
|
|
|
|
Are you using window.open in the same way every time? Are you using .js files? If you have a site with 1000 pages and didn't use something like includes, master pages or some other templating mechanism you need to go slam your hand in a door and with your broken fingers write out "I will think about maintainability" a million times.
|
|
|
|
|
Hi Gray,
We have 1000 pages and we are using .JS files and some include files as well, So I guess I do not need to slam my hand in door and do not need to write with broken finger...
SO do you have any soluation for this now?
|
|
|
|
|
var openWindows = new Array();
window.openCustom = function(){
openWindows.push(window.open(arguments[0],arguments[1],arguments[2]));
}
Global search and replace window.open with window.openCustom. Then in your unload handler loop through openWindows. If you leave windows open and refresh the main page then you need to use an XMLHTTPRequest or some other callback mechanism to store the open windows on the server so it can be reloaded on postback.
|
|
|
|
|
|
Hi Mark,
I am not posting the same question. I know I asked this few days back but I have not find out the soluation. SO I am sharing what I am thinking off to find the solution. It might be possible that some one got some clue from the logic which is running in mind and can come up with some solution. I hope to get something from you guys.
Cheers,
RK..
|
|
|
|
|
From 14:01 4 Aug '10:
"I want to close all the pop-up windows if user click on log out link..."
From 50mins ago:
"My requirement is to close all the open pop-up windows when user click log-out..."
From 0:07 5 Aug '10
"I mean of not change existing modules means I can not change each and every program..."
From 50mins ago:
"The problem is that I can not change all the pages of application..."
Looks like a repost to me. Just because you changed the wording a little doesn't make it new or different.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hey experts
I am facing a problem from last couple of week,I am not finding any solution for that.
I need to check some file in local machine like- "c:\test.txt" through java script when page is getting load,so i can show/Hide a div accordingly.
although i tried
var fso = new ActiveXObject("Scripting.FileSystemObject");
// if condition to check whether the specified file exists or not.
if(fso.FileExists("C:\\test.txt"))
but its work in IE only after changing some setting in internet option, which is not secure.
Can anybody give right solution for all browser
It would be great
Thanks in Adv..
Shafiq
|
|
|
|
|
Yes, you did ask this a while ago. And you were given the answer then.
|
|
|
|
|
Hi,
I am new to jQuery. We are using jQuery ui.1.0 in our project. We are using jQuery to show the dialog box. It has CSS implmented for the dialog title and the content. The CSS works well within the dialog box when seen in IE6 but the CSS does not get implemented when the same dialog box is opened/diaplayed in IE8.
Within the IIS I have added below header for the page where the dialogbox is been implemented.
Header name => X-UA-Compatible
Header value => ID=6
What other changes do I need to make in order to make this work in IE8 as well?
Below is the .css code
.flora .ui-dialog,
.flora.ui-dialog {
background-color: #e6f7d4;
}
.flora .ui-dialog .ui-dialog-titlebar,
.flora.ui-dialog .ui-dialog-titlebar {
border-bottom: 1px solid #d8d2aa;
background: #ff9900 url(i/dialog-title.gif) repeat-x;
padding: 0px;
cursor: move;
height: 28px;
_height: 29px;
}
.flora .ui-dialog .ui-dialog-titlebar-close,
.flora.ui-dialog .ui-dialog-titlebar-close {
width: 16px;
height: 16px;
background: url(i/dialog-titlebar-close.png) no-repeat;
position:absolute;
top: 6px;
right: 7px;
cursor: default;
}
.flora .ui-dialog .ui-dialog-titlebar-close-hover,
.flora.ui-dialog .ui-dialog-titlebar-close-hover {
background: url(i/dialog-titlebar-close-hover.png) no-repeat;
}
.flora .ui-dialog .ui-dialog-title,
.flora.ui-dialog .ui-dialog-title {
margin-left: 5px;
color: white;
font-weight: bold;
position: relative;
top: 7px;
left: 4px;
}
.flora .ui-dialog .ui-dialog-content,
.flora.ui-dialog .ui-dialog-content {
margin: 1.2em;
}
.flora .ui-dialog .ui-dialog-buttonpane,
.flora.ui-dialog .ui-dialog-buttonpane {
position: absolute;
bottom: 8px;
right: 12px;
width: 100%;
text-align: right;
}
.flora .ui-dialog .ui-dialog-buttonpane button,
.flora.ui-dialog .ui-dialog-buttonpane button {
margin: 6px;
}
.flora .ui-dialog .ui-resizable-n,
.flora.ui-dialog .ui-resizable-n { cursor: n-resize; height: 6px; width: 100%; top: 0px; left: 0px; background: transparent url(i/dialog-n.gif) repeat scroll center top; }
.flora .ui-dialog .ui-resizable-s,
.flora.ui-dialog .ui-resizable-s { cursor: s-resize; height: 8px; width: 100%; bottom: 0px; left: 0px; background: transparent url(i/dialog-s.gif) repeat scroll center top; }
.flora .ui-dialog .ui-resizable-e,
.flora.ui-dialog .ui-resizable-e { cursor: e-resize; width: 7px; right: 0px; top: 0px; height: 100%; background: transparent url(i/dialog-e.gif) repeat scroll right center; }
.flora .ui-dialog .ui-resizable-w,
.flora.ui-dialog .ui-resizable-w { cursor: w-resize; width: 7px; left: 0px; top: 0px; height: 100%; background: transparent url(i/dialog-w.gif) repeat scroll right center; }
.flora .ui-dialog .ui-resizable-se,
.flora.ui-dialog .ui-resizable-se { cursor: se-resize; width: 9px; height: 9px; right: 0px; bottom: 0px; background: transparent url(i/dialog-se.gif); }
.flora .ui-dialog .ui-resizable-sw,
.flora.ui-dialog .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: 0px; bottom: 0px; background: transparent url(i/dialog-sw.gif); }
.flora .ui-dialog .ui-resizable-nw,
.flora.ui-dialog .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 29px; left: 0px; top: 0px; background: transparent url(i/dialog-nw.gif); }
.flora .ui-dialog .ui-resizable-ne,
.flora.ui-dialog .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 29px; right: 0px; top: 0px; background: transparent url(i/dialog-ne.gif); }
Below is the jQuery code
(function($)
{
$.ui = $.ui || {};
$.fn.dialog = function(o) {
return this.each(function() {
if (!$(this).is(".ui-dialog")) new $.ui.dialog(this, o);
});
}
$.fn.dialogOpen = function() {
return this.each(function() {
var contentEl;
if ($(this).parents(".ui-dialog").length) contentEl = this;
if (!contentEl && $(this).is(".ui-dialog")) contentEl = $('.ui-dialog-content', this)[0];
$.ui.dialogOpen(contentEl)
});
}
$.fn.dialogClose = function() {
return this.each(function() {
var contentEl;
if ($(this).parents(".ui-dialog").length) contentEl = this;
if (!contentEl && $(this).is(".ui-dialog")) contentEl = $('.ui-dialog-content', this)[0];
$.ui.dialogClose(contentEl);
});
}
$.ui.dialog = function(el, o) {
var options = {
width: 300,
height: 200,
position: 'center',
buttons: [],
modal: false,
drag: true,
resize: true,
shadow: false
};
var o = o || {}; $.extend(options, o);
this.element = el; var self = this;
$.data(this.element, "ui-dialog", this);
var uiDialogContent = $(el).addClass('ui-dialog-content')
.wrap(document.createElement('div'))
.wrap(document.createElement('div'));
var uiDialogContainer = uiDialogContent.parent().addClass('ui-dialog-container').css({position: 'relative'});
var uiDialog = uiDialogContainer.parent()
.addClass('ui-dialog').addClass(uiDialogContent.attr('className'))
.css({position: 'absolute', width: options.width, height: options.height});
if (options.modal == false && options.resize == true) {
uiDialog.append("<div class='ui-resizable-n ui-resizable-handle'></div>")
.append("<div class='ui-resizable-s ui-resizable-handle'></div>")
.append("<div class='ui-resizable-e ui-resizable-handle'></div>")
.append("<div class='ui-resizable-w ui-resizable-handle'></div>")
.append("<div class='ui-resizable-ne ui-resizable-handle'></div>")
.append("<div class='ui-resizable-se ui-resizable-handle'></div>")
.append("<div class='ui-resizable-sw ui-resizable-handle'></div>")
.append("<div class='ui-resizable-nw ui-resizable-handle'></div>");
uiDialog.resizable();
}
uiDialogContainer.prepend('<div class="ui-dialog-titlebar"></div>');
var uiDialogTitlebar = $('.ui-dialog-titlebar', uiDialogContainer);
var title = (options.title) ? options.title : (uiDialogContent.attr('title')) ? uiDialogContent.attr('title') : '';
uiDialogTitlebar.append('<span class="ui-dialog-title">' + title + '</span>');
uiDialogTitlebar.append('<div class="ui-dialog-titlebar-close"></div>');
$('.ui-dialog-titlebar-close', uiDialogTitlebar)
.hover(function() { $(this).addClass('ui-dialog-titlebar-close-hover'); },
function() { $(this).removeClass('ui-dialog-titlebar-close-hover'); })
.mousedown(function(ev) {
ev.stopPropagation();
})
.click(function() {
self.close();
});
var l = 0;
$.each(options.buttons, function() { l = 1; return false; });
if (l == 1) {
uiDialog.append('<div class="ui-dialog-buttonpane"></div>');
var uiDialogButtonPane = $('.ui-dialog-buttonpane', uiDialog);
$.each(options.buttons, function(name, value) {
var btn = $(document.createElement('button')).text(name).click(value);
uiDialogButtonPane.append(btn);
});
}
if (options.modal == false && options.drag == true) {
uiDialog.draggable({ handle: '.ui-dialog-titlebar' });
}
this.open = function() {
var wnd = $(window), top = 0, left = 0;
switch (options.position) {
case 'center':
top = (wnd.height() / 2) - (uiDialog.height() / 2);
left = (wnd.width() / 2) - (uiDialog.width() / 2);
break;
case 'left':
top = (wnd.height() / 2) - (uiDialog.height() / 2);
left = 0;
break;
case 'top':
top = 0;
left = (wnd.width() / 2) - (uiDialog.width() / 2);
break;
}
uiDialog.css({top: top, left: left});
uiDialog.appendTo('body').show();
};
this.close = function() {
uiDialog.hide();
};
uiDialog.show();
this.open();
if (options.shadow && $.fn.shadow != undefined) {
uiDialog.shadow();
}
}
$.ui.dialogOpen = function(el) {
$.data(el, "ui-dialog").open();
}
$.ui.dialogClose = function(el) {
$.data(el, "ui-dialog").close();
}
})(jQuery);
Regards,
Vipul Mehta
|
|
|
|
|
well, this seems to be a silly question but is getting on my nerves -.-
i am working with Javascript and Jquery,
i have a password <input> tag which is not nested in a form, i want to check wether the input matches a constant defined by me when typed by user and length = 4
here goes my current code :
<div id="pin">
PIN:<input id="pinin" type="password" value="" onchange="showValue(this);" size="5" name="password" maxlength="4"></input>
<button value="Validate" name="Validate" onclick="javascript:check()">Validate</button><br />
<a href="publ.html" title="Public Page">I dont know PIN, go to Public Page >></a><br />
</div>
i had to add " to div, else it would just show "pin"
|
|
|
|
|
Shantanu Gupta 1337 wrote: but is getting on my nerves
Which part of it is gettng on your nerves?
You already have tied 'check()' javascript method on button click.
function check()
{
}
BTW: Why have you defined 'onchange="showValue(this);' for password field? It doesn't make sense here based on other control validating it.
|
|
|
|