Re: Get url from a textfile
Quote:
Originally Posted by
GK5
Hello,
Is it possible to get the url-link in the web properties of an object from a text-file.
On my local dashboard-page I have created a popup-menu to open different Gmail mailboxes.
However, Google changes the ID-numbers of the mailboxes from time to time. So I have a textfile with the mailbox (username) and the Google ID-number (0 to 9) on one line.
I wonder if it is possible to connect each item of my menu (each item has a web property) to one line of the textfile or if easier each item of the menu to one specific text-file with only one line containing the correct url.
The url to use for the different gmail inboxes is always: "https://mail.google.com/mail/u/0/#inbox" where the 0 (zero) can be 0 to 9.
Frank
Frank, from what you have described, you will have a menu item and its its URL will have to change as Gmail changes the index to your mailboxes.
You should be able to create one or a number of JS files, with a variable relating to each mailbox (var gmail_green = 5; ), etc.
The file would have to be published to your site.
It would be loaded with a head line such as - <script src="index_htm_files/gmail.js"></script>
Each url would have to be a JavaScript construct of form - javascript: window.location.href='https://mail.google.com/mail/u/' + gmail_green + '#inbox';
Any change of the data probably requires a page refresh or even clearing the local cache.
It probably could be done dynamically through Ajax calls but this requires a lot more coding.
Acorn
Re: Get url from a textfile
TO: Acorn
Is it possible to give me an example of such a Javascipt since I don't known anything about Javascript.
If I have an example I can start experimenting.
Thanks
1 Attachment(s)
Re: Get url from a textfile
Rather than go to the bother of adding a separate JS file, for this demo, I put the JS variables into the Page Head directly.
I included an alert to demonstrate the resolution to the index numbers.
Attachment 122909
Acorn
Re: Get url from a textfile
Thank you very much. I'm sure this will give me the the right solution.
Frank
Re: Get url from a textfile
TO: Acorn
I've tried your example and that works fine when the JS is in the Xara File.
I have now tried to change the concept and put the JS-file in index_htm_files which is easier for me for maintenance.
However this is not working.
This is what I've done:
Header page properties:
<script src="index_htm_files/gmail.js">
</script>
Object link properties:
javascript: alert(window.location.href='https://mail.google.com/mail/u/' + gmail_blue + '/#inbox');
javascript: alert(window.location.href='https://mail.google.com/mail/u/' + gmail_green + '/#inbox');
gmail.js in index_htm_files:
<script
var gmail_green = 5;
var gmail_blue = 3;>
</script>
I've put my Xara-testproject in a RAR-file but I could'nt find how to attach it.
Frank
Re: Get url from a textfile
Quote:
Originally Posted by
GK5
TO: Acorn
I've tried your example and that works fine when the JS is in the Xara File.
I have now tried to change the concept and put the JS-file in index_htm_files which is easier for me for maintenance.
However this is not working.
This is what I've done:
Header page properties:
<script src="index_htm_files/gmail.js">
</script>
Object link properties:
javascript: alert(window.location.href='https://mail.google.com/mail/u/' + gmail_blue + '/#inbox');
javascript: alert(window.location.href='https://mail.google.com/mail/u/' + gmail_green + '/#inbox');
gmail.js in index_htm_files:
<script
var gmail_green = 5;
var gmail_blue = 3;>
</script>
I've put my Xara-testproject in a RAR-file but I could'nt find how to attach it.
Frank
Almost there Frank.
A referenced JS file does not need the SCRIPT tags as it knows it is JavaScript.
The file is just:
var gmail_green = 5;
var gmail_blue = 3;
It might still have worked if you had copied what I had used:
<script>
var gmail_green = 5;
var gmail_blue = 3;
</script> - the closing angle bracket was in the wrong place.
When you fin it all works, you can remove the alert() part of the Link:
javascript: window.location.href='https://mail.google.com/mail/u/' + gmail_blue + '/#inbox';
Acorn
Re: Get url from a textfile
Thank you very much. This is working!
Frank
Re: Get url from a textfile
Quote:
Originally Posted by
GK5
Thank you very much. This is working!
Frank
Frank, I'm glad. Come back with more questions or an update.
Acorn