[Xerte] detect/retrieve url of an LO

Dave Burnett d_b_burnett at hotmail.com
Mon Sep 21 12:52:35 BST 2009



And another option:

If you have a permanent server environment, the app can bounce a call out to a page that simply takes the HTTP Referrer info and bounces it straight back.

No JS, no browser dependency, no security setting dependency.

Just a GetUrl (or LoadVars, or whatever they call it now) 



Subject: RE: [Xerte] detect/retrieve url of an LO
Date: Mon, 21 Sep 2009 12:44:39 +0100
From: Patrick.Lockley at nottingham.ac.uk
To: xerte at lists.nottingham.ac.uk



















function where_am_i(){

 

              if(window.location){

 

                           alert(window.location);

 

                     }else{

 

                           alert(window.location());  

 

              }

       

       }

 

Tested
and works in ie8, ie7, chrome, firefox, opera, safari, etch-a-sketch, speak and
spell, guttenberg printing press……

 





From:
xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of RonM

Sent: 21 September 2009 12:34

To: 'Xerte discussion list'

Subject: RE: [Xerte] detect/retrieve url of an LO





 

Nope that’s what I used
too (except my_location=) 

 

Still doesn’t work in
IE. (IE7) I get null in IE but the full url in firefox. Seems too unreliable to
make it worth using L

 





From:
xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney

Sent: 21 September 2009 12:16

To: Xerte discussion list

Subject: RE: [Xerte] detect/retrieve url of an LO





 

I don’t think it makes
any difference: try it. I used 

 

url = callJS(' function(){
return document.location.href.toString();}');

 

then displayed it in the text
icon with {url}

 

 





From:
xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk]
On Behalf Of RonM

Sent: Monday, September 21, 2009 12:11 PM

To: 'Xerte discussion list'

Subject: RE: [Xerte] detect/retrieve url of an LO





 

Thanks Julian

What code did you use for
that? Also that’s obviously a stand alone LO not accessed via toolkits –
could that be making the difference?

 





From:
xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney

Sent: 21 September 2009 10:40

To: Xerte discussion list

Subject: RE: [Xerte] detect/retrieve url of an LO





 

Works in both IE and Firefox
for me:

 

http://www.nottingham.ac.uk/~cczjrt/js/

 

 

 





From:
xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of RonM

Sent: Monday, September 21, 2009 10:34 AM

To: 'Xerte discussion list'

Subject: RE: [Xerte] detect/retrieve url of an LO





 

Thanks for the suggestion
Dave but as before for me that works in Firefox but not IE. (IE7)

 





From:
xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk]
On Behalf Of Dave Burnett

Sent: 21 September 2009 00:41

To: Xerte list

Subject: RE: [Xerte] detect/retrieve url of an LO





 





Bit more poking around:



Try this one in IE just for laughs:



callJS('
function(){ return 

document.location.href.toString();}'); 





















From:
ronm at mitchellmedia.co.uk

To: xerte at lists.nottingham.ac.uk

Subject: RE: [Xerte] detect/retrieve url of an LO

Date: Sun, 20 Sep 2009 23:21:55 +0100



Thanks Pat and Dave

I got a bit bored with some
other work I was doing so just did a few more tests via a localhost
installation so in case this is of use to anyone in future a quick update:

 

My tests echo what Dave has
said my_location = callJS('window.location.href.toString'); gives exactly what
I was after e.g the url ending with play.php?template_id=8 but unfortunately
this doesn’t work in IE and most of the colleges and staff I work with
still use IE by default.

 

I looked at the flashVars and
my_location=_root.site_url; certainly works in all browsers and I thought that
combined with root.linkID and a bit of joining  might give me what I
wanted but root.linkID gives undefined irrespective of browser.

 

A couple of the flashVars
seem to include the id e.g. FileLocation equals USER-FILES/8-guest-Nottingham/
and the 8 is the id so a bit of string manipulation gives me what I wanted
where I can automatically re-create the url with the correct ID on the end.

 

However I realised
that’s still not universal and a question for Pat I guess – some
installations will be play.php?template_id=8 others will just be play_8 is
there any way I can automatically detect that? 

 

Cheers

Ron

 





From:
xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Patrick
Lockley

Sent: 20 September 2009 01:28

To: Xerte discussion list; Xerte list

Subject: RE: [Xerte] detect/retrieve url of an LO





 





the site_url is passed in as a flashvar,
probably script accessible as _root.site_url - the id can be get at from
templateData (I think).







 















From:
xerte-bounces at lists.nottingham.ac.uk on behalf of Dave Burnett

Sent: Sat 19/09/2009 21:16

To: Xerte list

Subject: RE: [Xerte] detect/retrieve url of an LO





Is
that null in IE?



I just did some poking around and it looks like the original call works in
FireFox/Mozilla, but IE won't let you call the location object directly, it has
to be through a function in the <head>.



Good old IE.

ActiveX didn't manage to totally win the browser war, but it sure introduced
the world to a lot of viruses (virii?)



;-) 



 















From:
ronm at mitchellmedia.co.uk

To: xerte at lists.nottingham.ac.uk

Subject: RE: [Xerte] detect/retrieve url of an LO

Date: Sat, 19 Sep 2009 20:04:58 +0100



Thanks for the suggestion
Dave

I did try something like that
and just tested again using your suggestion. When I try that locally I get
file:///I:/xerte/test_templates/index.htm but online via a toolkits
installation I get null. As Julian suggested I was wanting something like
server.com/toolkits/play_123 and to be honest that’s further complicated
by the fact that the QR code and short url are generated at runtime, so even if
I could get this working it might give unpredictable results if the LO is
embedded or played via preview rather than the public url. So in short
I’ve left it so that the author just adds the public url of the LO or the
address of another site/page when authoring rather than have an option for the
url of the LO to be automatic.

 

Thanks for your help

Ron

 





From:
xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk]
On Behalf Of Dave Burnett

Sent: 19 September 2009 19:32

To: Xerte list

Subject: RE: [Xerte] detect/retrieve url of an LO





 



Ron, that's why asked if the callJS could talk to the DOM directly.



In the archives I found this posted by Julian:



I added a new function 'callJS(functionName, parameters)' which wraps

Flash's ExternalInterface.call method.

Use it like this:

callJS('myJavascriptFunctionName', 'parameters');







 







  







 







   







 







  







 







    







 







  







 







   







 







  







 







    







 







  







 







   







 







  







 







    







 







  







 







   







 







  







 







     

Now,
if it is a wrap of the ExternalInterface.call method, which looks like this:



ExternalInterface.call(”window.location.href.toString”);



then in your code,



my_location = callJS('window.location.href.toString');



*should* give you the URL location of the page the .rlo (or at least the swf
engine) is executing from.

No need for any extra javascript in the <HEAD>. 



Dave















From:
ronm at mitchellmedia.co.uk

To: xerte at lists.nottingham.ac.uk

Subject: RE: [Xerte] detect/retrieve url of an LO

Date: Sat, 19 Sep 2009 19:03:09 +0100



Hi Julian

As we discussed I really
wanted this to work without the need for any additional javascript so that it
could be used via any toolkits installation so if there is a function in the
existing code somewhere please let me know. As we briefly discussed it would be
really good if there was a way of containing all the code in the models and
have those automatically detected and displayed as page types available. It
would make updating and keeping custom pages in sync much easier.

 

I’ve created a simple
example of each of the four custom page types I’ve adapted and integrated
and made them available as a zip too at http://mitchellmedia.co.uk/?p=230 

 

Cheers

Ron

 





From:
xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of RonM

Sent: 18 September 2009 09:52

To: 'Xerte discussion list'

Subject: RE: [Xerte] detect/retrieve url of an LO





 

Yes
indeed!       ....?

 





From:
xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney

Sent: 18 September 2009 09:28

To: Xerte discussion list

Subject: RE: [Xerte] detect/retrieve url of an LO





 

I think what you want is the
server.com/toolkits/play_123, right?

 

 





From:
xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett

Sent: Friday, September 18, 2009 12:20 AM

To: Xerte list

Subject: RE: [Xerte] detect/retrieve url of an LO





 



Can you talk to the DOM directly with callJS?

Maybe just window.location?



















Subject:
RE: [Xerte] detect/retrieve url of an LO

Date: Thu, 17 Sep 2009 15:40:36 -0700

From: Paul.Swanson at harlandfs.com

To: xerte at lists.nottingham.ac.uk



You might try a javascript
function in the launching web page:

 

function returnURL() {

    var
baseURL = document.URL;

    return
baseURL;

}

 

Then use Xerte’s
callJS() method to get it.

 







From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of RonM

Sent: Thursday, September 17, 2009 3:29 PM

To: 'Xerte discussion list'

Subject: RE: [Xerte] detect/retrieve url of an LO





 

Thanks for the suggestion but
that doesn’t work for what I want. _url comes close but this may be a question
for Pat as what I really want is to automatically detect, or at least
dynamically create, the public url of the LO. Hopefully Pat will have a
suggestion tomorrow.

 





From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Paul Swanson

Sent: 17 September 2009 22:53

To: Xerte discussion list

Subject: RE: [Xerte] detect/retrieve url of an LO





 

FileLocation?

 







From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of RonM

Sent: Thursday, September 17, 2009 2:50 PM

To: 'Xerte discussion list'

Subject: [Xerte] detect/retrieve url of an LO





 

Hi Pat/Julian

I should probably know this but is there a
system variable or functions or something which automatically contains the url
of the LO? 

Cheers

Ron







 



















Hotmail: Powerful Free email with security
by Microsoft. Get it
now.



 















Bing brings you health info from trusted
sources. Try
it now!



 















Your E-mail and More On-the-Go. Get Windows
Live Hotmail Free. Sign
up now. 





 















Your E-mail and More On-the-Go. Get Windows
Live Hotmail Free. Sign up now.


_________________________________________________________________
Hotmail: Free, trusted and rich email service.
http://clk.atdmt.com/GBL/go/171222984/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20090921/11317c8b/attachment.html


More information about the Xerte mailing list