Getting The Web Server Name Through Javascript
Sep 19, 2005
Is it possible to get the web - server name through Javascript? If yes, how?
My code goes as follows. I get an error after executing this
<html>
<head>
<title>Untitled</title>
<script>
function disp()
{
str1 = location.host();
alert(str1);
}
</script>
</head>
<body>
<cfoutput>
<a href="##" onclick="disp();">Click me</a>
</cfoutput>
<cfabort>
</body>
</html>
View 2 Replies
ADVERTISEMENT
Jul 23, 2005
However, this piece of Javascript uses some other script which is large.
<script src = "./js/tmp.js".....>
This will work if the file "tmp.js" is local. However this reduces the
portability of my *utility* Javascript
as users have to have that "tmp.js" for every webpage they have (if they
want to use it :D)
I thought of uploading "tmp.js" it to somewhere and change my code to
<script src = http://www.somewhere.com/js/tmp.js ....>
The all the users have to do is copy the piece of code that I wrote
BUT THIS DOES NOT WORK. I TRIED IT.
My questions are:
1. Is there something wrong with server-side Javascript? Or am I missing
something?
2. Is there another way to make my code portable?
View 2 Replies
View Related
Feb 2, 2006
I'd like to implement a server socket in java: something linke the following example.
The problem is that the HTML has not the permission to execute instruction
serverSocket = Components.classes["@mozilla.org/network/server-socket;1"].
createInstance(Components.interfaces.nsIServerSock et);
Question:
1 - how do I give it this permisison?
2 - one solution I thought was to put the javascript code in a firefox
extension, to load, so it should have all needed permisison, but,
How can I call a java script function define in an extension
from an html page? - there's some particular syntax? ....
View 2 Replies
View Related
Feb 16, 2006
I have three different web pages with different domains, and I want to
show some pages of one of the webs in the others.
I use an iframe for this and it shows it good until I have to call a
javascript function in the iframe inside page, I have a permission
denied because the domains of these pages are different.
So, the cuestion is:
Is there some way to call the javascript function of the iframe from
the parent page?
View 2 Replies
View Related
Sep 29, 2006
The script below loads a calendar page in an iframe and scrolls to
today's date.
It works just dandy on my apache/linux server, but won't do anything
when I use IIS. (Nothing appears on the page at all where the script is
at.)
I'd appreciate any suggestions on how to make this work from the IIS
server. Code:
View 5 Replies
View Related
Nov 3, 2006
I might be turning a corner today and seeing the light. I might still
be confused :)
If JavaScript is the language for the browser then why do servers use
Ruby/Rails, Perl/Catalyst, Python/Turbogears or PHP/Cake? Is it because
the prototype-based language is too different to be chosen except when
necessary. Is it because browser bugs make people think JavaScript is
bad? Is JavaScript not suitable for the server-side for any reason?
I imagine that if server-side programmers started to learn JavaScript
then the client-side code in the world might start to improve.
Translation layer libraries like Prototype.js or Mochikit wouldn't need
to exist. The more I learn about JavaScript the more I like it. It is
difficult to learn however for multiple reasons.
View 5 Replies
View Related
Jul 20, 2005
I have seen web pages sites, when you drop down a list box, it seems to go
back to the server to retrieve some data without reloading the whole page
(e.g. select make of car and it retrieves a list of models from the server
to populate another list box).
View 1 Replies
View Related
Jan 18, 2007
I was handed a project that, when launched, had some ajax problems--specifically, "Error: uncaught exception: Permission denied to call method XMLHttpRequest.open." That's easy enough to fix--found the call in the .js file that was referencing the development server instead of the live server, and I am aware of Javascript's same-origin policy, which makes good clean sense. Change that call, problem solved.
Unfortunately, it's not solved. I can change the reference from
var url='http://www.devserver.com/function.php?id='+id;
to
var url='http://www.liveserver.org/function.php?id='+id;
but that doesn't solve the issue of if someone comes to the page without the 'www' or to the other domain, whose TLD is a .com instead of .org.
In PHP, I'd simply write the function to dynamically generate the url string, using $_SERVER variables rather than hardcoding the url. But I'm no javascript guy. Any help would be appreciated.
I'd rather not have to put a php redirect in every page to make sure the url is what I want it to be. I'd much rather learn something new about Javascript.
View 3 Replies
View Related
Jul 23, 2005
I have a number of server-side Javascript applications running on an
old Netscape Enterprise server. I want to move them to Apache. Is
there a way to do this without extensive recoding ? My code contains
a lot of Oracle and SQL Server database interaction.
View 2 Replies
View Related
Jul 23, 2005
Is it possible to get the Server IP Address from Javascript
ie., when the user types "http://10.0.0.10/main.htm" in the web
browser, i need to retrive the value of the IP Address(10.0.0.10) from
my client side javascript.
View 2 Replies
View Related
Nov 23, 2005
I want to populate my client's webpage (Remote Server) automatically
through my Server and Database by having him just paste a javascript
on his webpage.
I have read up about Microsoft Remote Scripting but the documentation
states the following : "The server which you make remote scripting
calls must be the same server from which you requested the client page
containing the requests."
In my case , the client and server pages are on two seperate servers
which means that I cannot use MS Remote Scripting.Is there an alternate
approach in any scripting language ???
Any suggestions, tutorials , websites , code snippets will be
appreciated while i continue to research on this...
View 4 Replies
View Related
Aug 2, 2006
Ref. http://support.microsoft.com/kb/834489/en-us
Now that http://username:password@site.com no longer is an accepted
syntax in IE, I suddenly have a case in a project I'm working on. The easiest(?)
solution would now be that there was some Javascript function that
could pass the username and password or in som other way automate the login
process on a given site.
Thing is I have a server-generated HTML page that I want to make the
client redirect to a password protected site. (IIS Windows authentication).
Before: location.href='http://name:pwd@site.com'
Now: ?
View 3 Replies
View Related
Jan 20, 2007
I'd like to adapt some Greasemonkey scripts that I've written and have
them applied to html files on the server side before the files are sent
to users. I'm only looking at adapting scripts that make static
changes to pages. For instance, consider a script that removes from
the DOM any img that has "ad" in its src.
I'm sure there are better ways to do this and I'm not even necessarily
looking for an extremely efficient solution. Mostly, I just want to
know if there's an existing product that could do this or with
reasonable effort could be made to do this.
View 5 Replies
View Related
Aug 29, 2007
I want control a hardware device using a Web browser.
I created a page which has a form containing all necessary INPUTs.
By clicking a button, all current settings are sent to the server side
(using POST or GET) so that the server can interact with the hardware,
which is under the server's control.
Now, in some cases, I want to update the INPUT (w/ readonly) with the
data from the hardware, such as a status value.
Most primitive approach is creating a new page with new value to the
INPUT, where I want to show the value.
But that is not quite efficient as the page appearance won't change
except the contents of the INPUT.
As Javascript can make any change to the HTML page (at client's side)
that is currently being displayed, it is more straight forward if the
server can send a set of Javascript commands to the web server so that
it can just update the display contents rather than refreshing
everything.
I thought such scheme was already available, but so far, I don't see
anything usable.
The Web server is not a commercial one but a custom Web server
(written in Python) so that I want to keep the scheme as simple as
possible. I checked AJAX but I'm not sure I can use AJAX in my
application.
View 10 Replies
View Related
Oct 13, 2005
I am a .Net Developer. I want to know to write javascript for serverside controles.And where it is placed for sever sidr controls. Please tell me if any one know this.
View 1 Replies
View Related
Jun 8, 2005
How portable is server side javascript? Does server side javascript works the same across different browsers and operating system? What I should do to ensure it is more portable?
View 1 Replies
View Related
Apr 12, 2007
I am using a location in my javascript: '../../myfolder/myfile.asp'
I want to make the script reusable by pages in different folders. The 'myfolder' is in the root of my site. How can I target this from any other folder such as the vbscript server.mappath('myfolder/myfile.asp')?
View 2 Replies
View Related
Jul 23, 2005
I have recently set up a server certificate on a web site.
Under certain conditions I need to change the color of a html span
element.
I do this using the following javascript function called from the
onreset attribute of the form element.
function removeWarningMsg()
{
if (isIE) {
document.all.Warning.style.color = "<%=BACKGROUND_COLOUR%>";
}
return true;
}
This was working perfectly fine until I applied the server certificate
to the website. Now when executing this line of code the following error occurs:
Error: 'document.all.warning.style' is null or not an object.
View 2 Replies
View Related
Jan 23, 2007
I'm writing a program on Zimki, which I think uses SpiderMonkey as a server side Javascript engine.
My idea is to have an html file that someone else created, and look inside for cells in a table that have special known names, like name, description, etc. Then I want to figure out the <tr<tr/pair that encloses all of those special tags, and use that as a template to generate a bigger table from another datasource.
So, I'm wondering how I actually open a file and then parse it as html so I can poke around the DOM, all from the server side without involving a browser client.
View 2 Replies
View Related
Feb 12, 2007
I work for a financial company. I am planning to give a presentation
to rest of the development team (15 people) here on moving server side
logic to client-side javascript for an internal intranet application
rewrite. This approach will definitely stir up hot debate from
hardcore server-side Java folks who wants to do UI stuff even on the
server!. Since I am pretty much known as the JS or UI Guy of the
group, my Boss wants to hear the broad spectrum of PROs/CONs from each
proponent.
Personally, I think Javascript/Ruby is a more productive language than
Java.
My idea is simple. It is to convert most business logic to client-
side javascript and have calls to server-side code restricted to user
roles with data validation. Thats as simple as it gets.
Here are my list of arguments
1. True separation of UI logic from server-side data processing code
(no more server code spitting out client-side code)
2. Better user experience with faster response
3. The whole web 2.0 thing (no page refresh) :)
4. Offload client processing from server therefore reducing network
traffic (not really a strong argument is this?)
Keep in mind this is an internal app. Even if someone figures out the
JS logic behind the page and try to hack the app by posting to
Servlets, they will be restricted by their login role, and data
validation will take care of any bogus data being submitted.
View 14 Replies
View Related
Nov 14, 2006
can you put an id into a server side include like you can other items using javascript?
I tried this putting the id name in the virtual address area but it doesn't work. I also tried replacing virtual with id instead still with no luck.
document.getElementById('dynstuff').src=content[newm]
<!--#include virtual="dynstuff"--><!--#include virtual id="dynstuff"-->
The error message says getElementById is null or not an object but it works fine with image ids and iframe ids. Can anyone tell me why this doesn't work?
View 4 Replies
View Related
Jul 23, 2005
I'm displaying a loggin page.
If the user entered an invalid UserName/Password I display the page again.
When this happens I want to give the user a different message then the one displayed when the page was initially displayed.
I use the Response.Redirect method from the page checking the submition.
When I do that I call the page with a parameter like this Response.Redirect("Page.asp?FROM=1").
When I get the parameter in the page I know I need to show a different message.
The problem is that if the page is called without the parameter, I
cannot determine that the parameter is missing.
The codse is very simple:
from_flag = Request.QueryString("FROM")
Now is the problem -
if I use if(from_flag == 'undefined') - this condition return
false.
but if I display from_flag using Response.Write(from_flag) I get "undefined"
if I use if(typeof from_flag == "undefined") - this does not work since the typeof return "object" in both cases when I call the page with the parameter or without the parameter.
also I tried to comnpare with null does not work.
By the way if I use VBScript as the script lang - it works fine I just need to compare the from_flag with vbNullString and all is well....
View 2 Replies
View Related
Jul 23, 2005
I have a few values and variables that I want to post to a server
(without using a SUBMIT button). Is there a way to post data from
within javascript - do sockets or connections have to be open for this
to work?
View 5 Replies
View Related
Nov 29, 2005
I am developing an ASP.NET (C#) application and need some help. I wish
to call a server-side function (in the code-behind "file.aspx.cs") upon
a user clicking on the "X" to close the browser window. Is there a way
to postback and call a server-side function when this happens? I am
aware of the browser's native "onunload" event, but am not certain that
what I'm looking for is actually possible.
View 2 Replies
View Related
Mar 29, 2006
I'm new to JavaScript. I have relatively large amounts of text (~200 kB) that I need to transfer to my web application every now and then. Using RAR, I get a 5:1 compression ratio on these files, for example one of 180 kB is compressed to 34kB.
Is there some standard way to decompress files in JavaScript?
View 1 Replies
View Related
Nov 17, 2006
We have a directory of files on our ftp server. Is there a javacript to
make a connection to the ftp server and compare files on a local drive
and on the server? Files that have been changed or added need to be
copied across from the ftp server to the local drive.
View 4 Replies
View Related