Saving Bandwidth With Javascript
Mar 7, 2003
What I'm doing is taking the parts of my web site that apear on every page, for example the tags from the first <html> tag to the <body> tag, and I just put some JS code into an external file that tells it to write that same code to the browser, then I call the external file where I had the original code.
That way the external file gets cached and they don't have to re-download that part of the code every time.
Combining this, with some other things including gzip I've been able to get my main index page down to 300 bytes, not including images, css files or js files, which are only downloaded once because of caching anyways(and they aren't that big in size themselves, either).
Of course this wouldn't work if you don't want to alienate people who don't use javascript, but 9/10 people do so for some this might be helpful...
Also, this still works with dynamic content as well. for example what I did for my main page where I display the news in little "news boxes" as I call them which are basicly divs setup so they look nice visually... what I did was make a function in the external JS file that accepts the different parts of the news box such as subject, body, time/date of post and who posted it, and then it creates the HTML for it. Then it's really easy to change the look of the displayed news by just changing the js file.
View 3 Replies
ADVERTISEMENT
Jul 20, 2005
I'm trying to come up with a script and I'm having a heck of a time...
I require users to enter the size (in MB or KB) of the attachment they
wish to transfer/upload. As they enter the number and move over to
the next field (using onBlur or...), I would like a popup/alert window
warning them that this attachment size would take "x" amount of time
based on a speed of 24 kilobits per second (kbps). If they are happy
with the amount of time, I wish to allow them to click OK (to carry on
with the transfer) or Cancel/No to cancel it.
View 4 Replies
View Related
Jul 23, 2005
WANT: Client to save an image to disk pressing a "download" button.
The image name is dynamic, from JS code on another part of the
page
DID: Read somewhere I can use document.execCommand("SaveAs") to do it
This solves it for MSIE, at least. My code is below
PROBLEM: What actually happens with MSIE is:
1) A window pops up promting me to save as.
2) The filename is correct, but the saveas type shown in the box is limited to "html" and "txt"
3) The "image" that is saved is not an image, but an HTML file containing the link to the image!! This is NOT what I want!
PLEASE help. How do I get MSIE to save the actual image instead?
PS With netscape, instead of the saveas dialogue, a window opens with
the image displayed. By clicking <CTRL-S> I can save the actual image.
CODE ----
View 5 Replies
View Related
Feb 23, 2006
I have the following code inside the <head> of my php file. What this code will do is change the style="display:none;" of a div element, depending on which option is selected within a combo box. Code:
View 1 Replies
View Related
Jul 23, 2005
Does anyone have a good java script that I can add to my page so that the same user doesn't pound my site and use all of my bandwidth?
View 12 Replies
View Related
Sep 24, 2007
Is there a way where I can "guess" what relative speed the user's
connection is?
Currently, the client is wanting some graphical intensive content and
I'd like to be able to warn users on dial-up to allow them to go to a
"gracefully degraded" version.
I thought of simply putting up a question for users to answer but the
client would rather it happen, more or less, automatically.
View 7 Replies
View Related
Jul 27, 2002
I found this on JavaScriptKit. It checks to see if the site accessing the data is your domain. I found it pretty cool.
//Beginning of "test.js" file
var accepted_domains=new Array("wsabstract.com","javascriptkit.com")
var domaincheck=document.location.href //retrieve the current URL of user browser
var accepted_ok=false //set acess to false by default
if (domaincheck.indexOf("http")!=-1){ //if this is a http request
for (r=0;r<accepted_domains.length;r++){
if (domaincheck.indexOf(accepted_domains[r])!=-1){ //if a match is found
accepted_ok=true //set access to true, and break out of loop
break
}
}
}
else
accepted_ok=true
if (!accepted_ok){
alert("You're not allowed to directly link to this .js file on our server!")
history.back(-1)
}
/////rest of your libray
"
"
"
View 1 Replies
View Related
Jul 23, 2005
I need to know the min bandwidth for streming picture?
View 1 Replies
View Related
Mar 22, 2010
How would you go about writing a script to switch the style sheet if low bandwidth is detected? Is this even possible?
View 3 Replies
View Related
Jun 12, 2006
I have a problem with cookies set via javascript. What I try to
achieve is, when a user comes on the intranet, he can click on a link (
a simple href) that will set the content to french or english. I want
to set a cookie to persist that choice each time the user comes back on
the intranet. This feature must be available everywhere on the
intranet and the link is placed in an inner asp script called Menu.asp
which is included each time a page loads.
Now, I know it's maybe not the best way to achieve this but I'm just
working from what has been made by others, I cannot change the way
things are made, too much work would be involved and they won't accept
to give time to do everything all over again.
The best approach I got was to set a querystring value and replace the
cookie value from vbscript code. The problem is, the intranet we have
use a lot of the querystrings for a lot of features and when I click
the English/French link, that info is lost. I've tried to set a
mechanism to keep all the querystring and only add a new value but I
got weird results...
So I've turned to Javascript and still got no luck... For some
reasons, the cookie gets deleted from the cookie file as soon as my
javascript modifies the cookie.
Here's an example:
View 1 Replies
View Related
May 9, 2007
I wrote a script to generate links to some pictures that I need to
regularly update our site with. Is there a way to write a script that
just saves the pics to a directory on my pc so I dont have to right
click on every link and do a save picture as...? I can't link
directly to the pics from our site because our site is https and the
site the pics are on are http so the user gets the security warning
box every time a pic loads. Code:
View 4 Replies
View Related
May 19, 2006
I have a log file that is viewed on the local machine. There are some
settings on the html page that allow the user to specify how the file
is viewed. I'm just wnodering what are my options in saving these
settings (so they could be reloaded next time the user loads the page).
Writing to registry, a file, or a cookie? what's the right approach?
View 4 Replies
View Related
Jul 20, 2005
I've got an online system which I'm interested in making available
offline - i.e. letting the user download certain HTML forms, fill them
out offline, then the next time he logs into the site, sending all the
data he filled out to the system. However, I can't seem to come up
with a good way to do this. I thought of using cookies (that'd be
great, since the system could detect them automatically), but it seems
I can't set cookies for my server offline; it has to be from a page on
the server itself. And from what I can tell, JavaScript doesn't have
the capability to write files on a local system either. Does anyone
have any ideas about how to go about this using JavaScript?
View 1 Replies
View Related
Apr 21, 2011
I am making a LOVE IT button using php and jquery and i have most of it working...
The button currently returns the value from the DB of 0 but when i click the button it wont save the incremented value to the DB.
see it here[URL]
my code is this
<?php
mysql_connect("localhost", "web183-loveit", "password") or die ("Error.");
mysql_select_db("web183-loveit") or die ("error");
$increase = "UPDATE results SET value=value+1 WHERE id=1;";
[Code].....
View 1 Replies
View Related
Jan 5, 2010
I have trying to save an update the xml file which is there in same folder in which HTML page is there. In HTMl page i have written javascript code to Save and Update XML on server.The code is like this
function Save()
{
var xmlDoc= new ActiveXObject("MSXML.DOMDocument")
xmlDoc.async="false"
[Code].....
When i am accessing HTMl page on server from client and this function is called error 'Parameter is incorrect' is showing on line
xmlDoc.save ("/show/Share%20Workspace/Nidhi/Share%20%Document/Account.xml")
Note: xmlDoc.load("/show/Share%20Workspace/Nidhi/Share%20%Document/Account.xml") is working fine.
The save is working fine in local but not when on server and request from client.
View 7 Replies
View Related
Jun 20, 2007
We have always been used to dynamic webs with JS.
We have used
document.getElementById("x").innerHTML=""
to edit specific HTML part.
My question is, as soon as the browser is closed, the inserted HTML codes vanishes...How to keep it everlong such that to save them as HTML files.
I want to create a small guestbook like something. I created and when i close the browser the inserted text vanished.....How can i keep it for ever??
View 2 Replies
View Related
Nov 6, 2009
I have created a 2D array as a sort of "game board" and would like to place an object(cubeShape) in each square and be able to interact with specific instances. Since I am using the O3D API, I would like to do this by taking the object's place in the transform matrix and storing it in the 2D array. The problem is, I run this code:
[Code]...
And then when I check it, every value in my array is filled with 9 instead of the actual count. i.e. myBoard[1,2] = 9, myBoard[2,2] = 9, etc. Whats going on?
View 2 Replies
View Related
Jul 13, 2004
I once came across some sites that prevent saving their pages by disabling the 'save' option in the File menu. I remember it was done. But I forgot the url.
How are they doing this? Is it possible to do so with Javascript? It will be great if someone provide me with links for such articles or scripts.
View 5 Replies
View Related
Apr 16, 2001
I want to save the form value for a persons USERNAME in a cookie when they are logging into my free e-mail service. So when they come back I can lookup the cookie and write the value for their username back into that spot in the form.
I've got it working for the drop-down menu so that it will change to whatever domain they selected the last time they logged in but I can't get it to work for the username box.
View 2 Replies
View Related
Nov 17, 2011
I've been working on my code for some time but I know I'm missing the ability to save the completed time card entry to a file. Can someone assist me with the scripting code for this.I would like the user to be able to specify the location. I have search the forum and I have not found any question like this which surprises me. Please forgive me if I have posted in the wrong area.Currently I have no Java Script code to show for this part of my project because I'm completely stuck. But I have my unfinished XML code that is not pretty because I plan on using a style sheet to enhance. But here is the code for you to get and Idea of what i'm attempting.
Code:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html
[code]....
View 4 Replies
View Related
May 18, 2009
is there anyway way of saving a cookie of a certain website permanently ? there are some sites that offer cookies for each promoter. therefore even if the visitor goes through some other link of another promoter the details of the first promoter will be retrieved from the previous cookie.
View 3 Replies
View Related
Sep 22, 2010
I'm working on my last JavaScript project for school and have encountered a few problems. The two issues that I'm having with this script are: - The cookies only work in Internet Explorer; - I can't figure out the code to save the 3rd text input field as a cookie that will automatically change the background color to the user's fav color.
Code:
<html>
<head>
<title>Exercice 07</title>
[Code].....
View 1 Replies
View Related
Nov 13, 2007
I need solution to change the url but not the page.
I need something like whan going to a site, the url changes to
whatever, but there is no page count, so I just get the new (right)
address, but when going back I go back to the page I came from.
Secondly I dont want a back-trap.
Why?
Say someone opens www.mysite.com, end is gives index.php to the clinet
- which enters a password and the browser offers to save that -
later, when logged out, the client is sent to www.mysite.com/index.php,
and the browser offers to save that password too... for another url,
but still the same page...
View 3 Replies
View Related
May 6, 2010
I'm trying to save a PDF file that's built using the jspdf PDF JS files [URL], the example (server side) uses Jaxer to save the file to the hard drive. Can i do this via JQuery instead? PDF Example
<script runat="server" type="text/javascript" src="../libs/base64.js"></script>
<script runat="server" type="text/javascript" src="../libs/sprintf.js"></script>
<script runat="server" type="text/javascript" src="../jspdf.js"></script>
<script runat="server" autoload="true" type="text/javascript">
[Code].....
View 1 Replies
View Related
Jan 5, 2012
i want to know if possible to save to file in the same mather of $(document).ready function () { $( '#reader') .load('Data/Le_Mensuel_1.txt'); }); or i have to use an outher function to save the content of my div(it is use like a Editable textbox)
View 2 Replies
View Related
Jul 20, 2010
i have used it for creating a table with Sorting and Paging. The table works perfectly without any issues per se except what i need now. I have used the following files: jquery-1.3.2.js, JQtable.js, and jquery.tablesorter.pager.js.
My problem is that there are links in 1 column of the grid. If a user clicks on the link, the user is redirected to another page. But when the user clicks on Back button, the Jquery Table always loads on the 1st Page with default settings and does not load the page on which the row wa present.
i need to go back to the same page of the table (from where the link has been clicked) with the same size for paging and sort order on clicking Back or a Link to the Page.
So in short - is there any pugin which we can use witht the jquery table to save the state and use it to load the table accordingly on Page Load?
View 3 Replies
View Related