473,397 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

modify URL and show the document with the new URL

manuelgk
Hello again!, In my investigation about know JS, I have a question about URL, I want to catch the URL and add a string like this: www.url.com?string.
I alredy do this and it work correctly, but when I try to load the page, in the navigator appear again the originally URL. So my question is how can I pass that URL to the navigator bar and show the document?, this is my code:
Expand|Select|Wrap|Line Numbers
  1.   <script type="text/javascript">
  2.  
  3.       window.onload=function() {
  4.               els=document.body.getElementsByTagName('*');
  5.                 for(c=0;c<els.length;c++){
  6.                   els[c].onclick=function(){
  7.                      getOnclicks(this);
  8.                    }
  9.                  }
  10.              }
  11.  
  12.              function getOnclicks(el) {
  13.              cadena=new String("?COLAB_CLICK=YES");
  14.                       if (el.tagName=="A") alert(el.getAttribute('href')+cadena);
  15.              }
  16.      </script>
as you can see, I put the string next to the href but it can be seen in the alert message and not in the navigator bar (directions bar).
Thanks everybody
Oct 5 '07 #1
6 3190
pbmods
5,821 Expert 4TB
Heya, manuelgk.

To redirect to a new URL, set window.location.href.

Note that this will redirect the browser (send a new page request).
Oct 6 '07 #2
thanks for your advice, but the problem here is with window.location.href I need to set the url, as you see in my code, the parameter pass taking the urls from the html code's part (links), so I don't know if there is a posibility to add to the URL the string save in the cadena variable, in other words, I want to load the page and then add my variable like this:

www.uv.mx?COLAB_CLICK=YES

This event or url must appear in the direction bar of the navigator. The navigator I use is Firefox
Kind regards
Oct 7 '07 #3
pbmods
5,821 Expert 4TB
Heya, manuelgk.

You'd be better off setting a cookie or using AJAX.
Oct 7 '07 #4
OK, and how can AJAX help me with this new problem? I mean, do you have an AJAX code that do this?
If any one else have a suggestion(s) please let me know it!!!
Thanks for respond

Kind regards
Oct 8 '07 #5
ok I solve my problem, the only thing that I need to do is put this instead of the alert.
Expand|Select|Wrap|Line Numbers
  1. el.href=el.href + cadena;
Thanks for your suggestions
Oct 8 '07 #6
pbmods
5,821 Expert 4TB
Heya, manuelgk.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Oct 9 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: titanandrews | last post by:
Hi, I have ran into a situation that I think should be possible, but I am fairly new to XSLT so maybe not. Suppose I have the following document <ROOT> <FOO name="A"> <CHILD name="B"/>...
3
by: user | last post by:
I created a window with var mywindow = window.open( "some/local.html", "mywindow", "width=..., "height=...., ..." ); The window shows up. It contains a table. <table> <tr> <td>begin</td>
11
by: tlyczko | last post by:
Hello Rob B posted this wonderful code in another thread, http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/c84d8538025980dd/6ead9d5e61be85f0#6ead9d5e61be85f0 I could not...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser?...
1
by: qasimraza1979 | last post by:
HI, I am currently analysing the scenario to modify word document if MS word in not installed on the server. Actually I was thinking to modify my word document using...
5
by: kidders | last post by:
Below is a script i need to modify to work and its driving me nuts. Essentially it fades the content of an array. The original script specified the object name, I tried to modify it to allow an...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.