[Xerte] detect/retrieve url of an LO

Dave Burnett d_b_burnett at hotmail.com
Mon Sep 21 00:41:16 BST 2009




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.
http://clk.atdmt.com/GBL/go/171222985/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20090920/990214dc/attachment.html


More information about the Xerte mailing list