Resolve Relative Server Links When HTML Source Is Not On Server

Feb 10, 2010

I would like to open an html file locally (not fetch it from a server) and somehow use javascript to fetch the relative resources from the server. One solution would be to convert all of the relative links to absolute links. I can convert the html source file anyway I wish, but ideally I would like to modify the html source as little as possible, for example insert a function that modifies the result of the src attribute. How would I go about this? Is there any trick I can use to define where the relative home is? Am I going to get into any scripting security gotchas?

View 3 Replies


ADVERTISEMENT

XMLHttpRequest: Script Works To Request XML File On Server But Not On External Server

Oct 2, 2010

I have the following JavaScript (see below). The script requests an XML file from the server and displays it on the page.

The script works fine when the requested XML file is stored on the same server as the script.

The problem is when I try requesting an XML file from an external server such as the National Weather Service. I get an error. If I take the XML file from the National Weather Service and save it to my server it works. Why can't I use my script to request XML files stored on external servers?

Javascript Code

window.onload = initAll;
var xhr = false;
function initAll() {
document.getElementById("makeTextRequest").onclick = getNewFile;

[Code]....

View 8 Replies View Related

AJAX :: Cross-domain Calls - Loaded From One Server Into A Website On Another Server

Mar 11, 2010

I'm trying to write a script that will be loaded from one server into a website on another server. This script is trying to talk (ajax) to the server that it comes from but I'm getting "Access Denied" errors. I'm well aware that cross-domain calls are not allowed for security reasons so my question is how does Google Analytics work because essentially thats what I'm trying to accomplish. I can embed a Google Analytics script into my website and it'll gather data and send it back to Google.

View 4 Replies View Related

AJAX :: Getting Server Date/time With No Server Side Script

Apr 19, 2010

I'd been looking for some way to get server date/time without using any server side script (such as ASP, PHP, etc).

I found this and it worked just excellent for me! I just want to share it because it wasn't easy to find.

I created a js document with code:

Code:

Now, I can use this js within a html like this:

HTML Code:

You may change your machine date/time and check both dates.

View 1 Replies View Related

JQuery :: Modifying Page Links That Is On Secure Server

Feb 26, 2010

I have a page that is on a secure server, lets say https://server.com and I have a link on a page /somelink.html. I am trying to use jQuery to change the link to http://server.com/somelink.html

Here is the code I have come up with:
$(document).ready(function() {
$("a[href^='https://server.com']")
.each(function(){
this.href = this.href.replace(/^https://server.com/,"http://www.server.co");
});
$("a[href^='/']")
.each(function(){
this.href = this.href.replace(/^//,
"http://www.server.co");
});
});

However, my code only seems to work in Firebug after everything has rendered. I assume that the links are changes when the Document is Ready but before the server address is attached to the links.

View 1 Replies View Related

Show Pdf Files From A Server Location As Links On A Webpage?

Oct 2, 2009

I am looking for a javascript code to display pdf files/links which are on a server onto a webpage. We are using an Oracle application and a javascript code can be embedded in it.

These pdf files will be generated everyday and going forward we will have almost 300+ files in a year. I tried using <a href="res/folderA/folderB/filename.pdf">Report for 10/01/2009</a> and it works fine. I could create 300+ links but most of the links would be dead since the pdf has not been generated for future dates and I don�t want to show dead links.

Can I show the pdf links/files dynamically? Like show only those files with links which are there on the server? The pdf files will be generated Mon-Fri and the naming convention for the PDF file would be MM-DD-YYYY-filename.pdf. Would it be possible to show the reports grouped by months? Getting the month from the file name and when someone clicks on that month then it shows only those files which have been generated in that month.

I tried using below code to get file names from a folder. It works fine on my local but doesn�t work on the server. But then it�s supposed to show only file names and not links :(

<script type="text/javascript">
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.GetFolder("res\folderA\folderB");
var fc = new Enumerator(f.files);

[Code]....

Also one more trivial question, I looked at the source code of the application and then saw that images used in that application are being called using href and location is under /res folder, where in the code is this specified? Pointer to that folder? What if I want to show some files/images which are not under /Res folder, where do I specify the location?

View 6 Replies View Related

Get Images From Folders On Server Instead Of List Of Image Links?

Jul 13, 2010

I have created a photography website myself and coded it all in dreamweaver cs4. Now i have created it using html, as i didnt want to limit it to flash users and loading times etc etc. So today i found myself a nice simple slideshow tool that uses html and javascript. i created it using a site online (which i will not post as i dont think we are allowed to post to online sites).

The slideshow loads images up in the background, and it plays them in a random order.

Now i am able to define individual image links to either a url of the an image, or point it to individual images, listing them one by one in my coding, which as a photographer having differet galleries is goign to be a royal pain when i want to have new images showing up.

So my idea is to replace the code that retrieves in dividual images from url's, to replace it with a piece of code that will display an image from a list of about 7 or 8 folders on my server all containing images....

i.e. displays an image from the folder .../images/models/pic01.jpg then it brings up an iamge from a different folder .../images/portrait/pic08.jpg.

Is there a way to do this and how can i go about it?

this is the code i currently have:

<!-- configurable script -->
<script type="text/javascript">
theimage = new Array();
// The dimensions of ALL the images should be the same or some of them may look stretched or reduced in Netscape 4.

[Code].....

View 4 Replies View Related

Saving A File On The Server W/ Js, Ie No Server Code

Dec 31, 2006

I am creating an XML document on my page with javascript. My question
is, is it possible to save that xml file on the server (I have write
permissions) only using javascript, ie no server code? This task would
be trivial using server code, but I was wondering if I can do it all
with client code and post backs? Well, any input?

View 1 Replies View Related

Show Hide Navigation Links Based On Server Names

Jul 23, 2005

I was wondering if anyone has any idea how this can be done. I am
trying to show/hide navigation links based on server names or ip
addresses. So if, someone visits a particular url/ip address he/she
sees only a particular set of navigation links. I am sure this can be
done using some kind of Java script or VB script, just not sure how.
I have two servers with different server names and IP addresses. Based
on user's input I need to display the hyperlinks which then directs the
user to other utilities. For this I need to create a script which takes
the user input and show/hide those link based on server name or ip
address.

for example -if the user types in- http://wxyz.com or 166.xx.xx.01 then
only two hyperlinks will be shown but if the user inputs-
http://uvwx.com or 166.xx.xx.02 then we want to show all the
hyperlinks.

View 5 Replies View Related

Server To Server Connection (with Clients)?

Dec 7, 2010

I already have a server connected to clients, clients send msgs and it echoes back to all of them and now i want when a client sends a msg it echoes on his server and the other server too .. so when any of the clients on any of the servers sends a msg it is broadcasted all over the servers to all clients

[Code]...

View 1 Replies View Related

Events - Add Server Control To Custom Webcontrol That Fires Function And A Server Side Function?

Jun 24, 2010

In ASP.Net, I am trying to create a WebControl. In this control, I have RenderControl method overridden with my html controls.

protected override void RenderContents(HtmlTextWriter output)
{
output.Write(@"<table><tr><td>");

[code]....

How can I make the button call the click event so that the server side method btnExecute_Click() can be called? Also, this button calls a javascript function before server side even.

View 5 Replies View Related

Server Side Javascript Parsing Of HTML?

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

Saving Content Of Html Page In Another Server

Jul 20, 2005

I'm incharge of updating the stats on a chl hockey teams Web Site. I
would like to know if there is a way (javascript) to be able to save
the content of the CHL Statistics WebPage on our Server with
Javascript, in a txt file.

If it possible, then I would take the content of that page. Execute
another script that will take this information an place it in our
database on our server. By doing this, our Team WebSite would be
update automaticaly.

At this time, I have to open the CHL Statistics WebPage. Then Save the
HTML page as a txt file, upload it on our server via FTP, then execute
my script that places it in our database.

Could you send your suggestions to rene.aube@gnb.ca?

View 4 Replies View Related

Server-Side HTML To JavaScript Vars In AJAX?

Mar 24, 2007

I want to load some pages generated with the server (ASP) and assign
their html results to JavaScript, so users could click the links and
the content of any selected page would show up immediately, making no
requests.

So, I have one main page called mainpage.asp which, I think, should
get all subpages with content, names are subpage1.asp, subpage2.asp,
etc. I tried ASP's XMLHttpRequest to get content of all sub pages and
assign html result to JavaScript variables. But I realized that MS
XMLHttpRequest does not get session protected pages. I mean that if my
subpage will generate output with session only, then even if the
session exists, MS XMLHttpRequest does not see it.

Anyway, this trick did not work. If I include these subpages in
mainpage.asp under a hidden field, this may be a solution but I do not
see it good enough yet.

What would you recommend? How would you assign subpage's html code to
JavaScript variables or array of variables?

View 3 Replies View Related

Upload Currently Displayed Html As A File To A Remote Web Server

Oct 16, 2010

I am developing extension which should upload currently displayed html as a file to a remote web server, unfortunatelly so far i haven't suceeded. I think this should be done through XMLHttpRequest(), but neither I know how to upload files through XMLHttpRequest nor how to convert string to file.

The HTML form that uploads a file:

But as I said i need my plugin to do it automatically and file must be made from html code.

View 5 Replies View Related

Connect To Server Script That Contains Json's And Represent Them In HTML

Feb 15, 2012

I need to use Jquery $.ajax() function in order to represent JSON objects in HTML page. JSONs are on a url: [URL]. That is a string of json objects.

View 1 Replies View Related

JQuery :: Firefox - Send Some Data To The Server And Put The Resulting HTML In A Div

Jun 10, 2010

I built a pretty simple Ajax request which needs to send some data to the server and put the resulting HTML in a div. Unforunately, I need to POST the data. I used .post() and it worked fine ... *on Chrome and Opera!* ... on Firefox no data gets posted even though firebug shows the data in it's console. I ended up building the longest possible request, just to try all the options. No luck. As soon as I POST anything, Firefox won't receive the data. If this was a Firefox issue, wouldn't I read about it everywhere? What's wrong?

View 2 Replies View Related

JQuery :: Retrieve Server Response After Submitting Form In HTML?

Dec 28, 2011

I have designed a form as below

<form action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/XXXXXXXXXXXX" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" target="_top" >
<input name="item_name_1" type="hidden" value="Test Product"/>
<input name="item_description_1" type="hidden" value="Test Product of my cart"/>

[Code].....

On hitting the button one new window is getting opened with response URL from 3rd party(in this case Google Checkout). But for me i need to open this in a inline-popup (lightBox, ColorBox etc...) rather than new window. In the form definition, i have replaced mymerchant_idwith 'XXXXXXXXXX' for privacy purpose

View 1 Replies View Related

Ajax :: Request Using Prototype Not Sending HTML Form To Server

Mar 20, 2007

I spent the best part of yesterday trying to get my form to be sent to the server however for the life of me I cannot figure out the problem. I haven't used prototype before but here is my code that I think should work perfectly fine,The php script works perfectly, i've entered test data into it and it makes a connection to the third party server using curl and then requests information that I get back i.e. the routing id comes back. But I cannot test the data using the form as the request isn't working for some reason.

View 3 Replies View Related

In HTML Website Connectivity To MS Access Database That Is Hosted On NIC Server

Sep 9, 2011

Html website what is the code in javascript to connect to a MS Access database that is hosted on NIC Server.If not so possible in javascript then any other option what can added in HTML website

View 1 Replies View Related

HTML Forms And Client-side Validation W/ Server Data?

Oct 28, 2010

I know that Javascript is client side, but I'd like to know the best way to populate HTML drop downs in real time based on information typed in the other HTML form fields with information found on the server as opposed to the client.For instance if a user wants to select certain files located in a directory on the server, as they type in the pathname supposedly containing the files the drop downs continually refresh themselves with the server files listed in that directory (if it exists, and apache has permissions to see what's inside) as if it was showing client files instead.

What would be nice is if my browser could continually query the server for some of its private information and not have to refresh itself to obtain it, whether that means the server-side would have to continually refresh itself makes no difference to me as long as the client-side doesn't have to. But I guess this is not possible because no matter what you would have to at least refresh the client-side page once?Submitting the form to a CGI or PHP script would not work because I need this functionality to help populate the form BEFORE I send it.I would like to not have to press a button to update the form every time I change the pathname and need to update the drop downs since this would be annoying.

View 2 Replies View Related

How Can I "include" An HTML File From *another* Server?

Mar 18, 2006

got the following problem: I need to include an HTML file that sits on
another server B in an HTML file that sits on server A, and I need to
include this at a particular place in the file. The "include" command
doesnt work obviously as it is server-side.

In other words: say I have a webpage, at a particular place, for
example halfway down, I want to include HTML that sits on another
server.

View 3 Replies View Related

JQuery :: Can't See Source (with View Source) When Loads External Html Into A Div?

Feb 23, 2011

I got some code that loads divs from other web pages into a particular div in my main page. In other words, I click on a button, and this tells jquery to load afragment of a particular page into my main page. For instance if I have 5 web pages onrock stars, I could have 5 buttons, and each button could load one rockstar's biography into a div on the main page (and replace whatever was there before). This works, and I do see the content that it loaded. But when I do 'view source' in IE, I do not see that content (the bio of the rock star). Another clue that this content is not really there, is when I try and run some code on that content. The content (from those external pages) have divs with specific names, and I try and make them into collapsible panels by running the following short function:

var IdentifyPanels = function() {
$("DIV.ContainerPanel > DIV.collapsePanelHeader > DIV.ArrowExpand").toggle(
function() {

[code]....

View 2 Replies View Related

Get Multiple Floating Divs To Pop Up Relative To Text Links?

Jan 15, 2010

I've got a scrolling text field that runs several pages deep, and I want to pop up multiple floating divs that will appear at the site of the text links (however deep in the scroll field). I can get multiple divs to pop by calling them layer1, layer2, etc. but they all pop relative to the position of layer1 (the only one specified in the javascript file). Is there a way to get each layer to appear next to the text link that fires it? code...

View 1 Replies View Related

App Won't Run On Server?

Nov 24, 2010

I have an app which preloads images from a folder called 'myimages'; I load the images using src='myimages/picture.jpg'. The 'myimages' folder is in the same folder as my web pages.My domain on the server is villaswfrance.com and I have copied the 'myimages' folder to the server at the same level as the web pages which are directly under the villaswfrance folder. When the app runs it fails when trying to load /myimages/picture.jpg. Does the leading / take me to the web pages or to the villaswfrance folder. If the latter I understand why it fails - if the former I do not understand.

View 5 Replies View Related

How To Get Data From Server

Jul 23, 2005

What i want to do is that this function post data to the server (ASP) and
the server will response with 'OK' My question is how can i send data clientside from Javascript to the server ? (navigate ? with url ?)

and check the returned data in the same function ?

function ShowData(TxtArt)
{
alert(TxtArt + ' : ' + parent.frames.Bottom.TxtUsrName.value + ' - ' +
parent.frames.Bottom.TxtRemarque.value); // testing purpose
// post the data to the server. ex .. myURL.asp?userID=1000&Art=ART1201
// fetch the data from the server. to verify if the 'OK' is recieved ->
the server will response with 'OK'
// if 'ok' -> i will update clientside an frame (ex. contents of
shoppingbasket)
}

Any idea's ?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved