Hi William 
is there a function somewhere where I could get the worksheet ID number?

For example my current URL is http://ipaddress:8080/home/admin/14/

Is there a way to get the 14 programatically?

thanks
Fred


On Wednesday, May 14, 2014 2:24:37 PM UTC-4, William wrote:
>
> On Wed, May 14, 2014 at 11:05 AM, kcrisman <[email protected] 
> <javascript:>> wrote: 
> > 
> > 
> > On Wednesday, May 14, 2014 12:57:50 PM UTC-4, Fred Gruber wrote: 
> >> 
> >> Hi 
> >> Since other people may use the notebook I would prefer if they didn't 
> have 
> >> to manually copy the URL. 
> >> 
> >> I noticed that the javascript variable "document.URL" have this 
> >> information but I'm not sure how to bring the value back to python. 
> >> 
> >> I tried the following in a cell but the webpage changes to another page 
> >> with the URL so I'm not sure how to use it. 
> >> test='<script>\ 
> >> document.write(document.URL);\ 
> >> </script>' 
> >> html.eval(test) 
> > 
> > 
> > Just to see that it works, you can use alert() instead. 
> > 
> > test='<script>\ 
> > a = window.location.hostname;\ 
> > alert(a);\ 
> > </script>' 
> > html.eval(test) 
> > 
> > And DATA would solve the rest. 
> > 
> > But I am stumped trying to get the whole thing to work together.   And I 
> > think that getting the domain name is something that the notebook server 
> is 
> > actually unaware of (it runs in various temp directories) so I'm not 
> sure 
> > that is possible from within, only with something JS-y.  I couldn't 
> quite 
>
> This is relevant -- it's python code to get the hostname: 
>
>
> http://stackoverflow.com/questions/4271740/how-can-i-use-python-to-get-the-system-hostname
>  
>
> > get it to work, but then again my jQuery is pretty rudimentary. 
>
>
> If anybody finds this thread and wants to do something similar in 
> SageMathCloud worksheets, it's 
>
>    salvus.pdf('tmp.pdf') 
>
> I think I even went a bit overboard and included jspdf (from Mozilla) 
> so that the above should work even 
> in the rare browser with no embedded pdf viewer... 
>
>  -- William 
>
> -- 
> William Stein 
> Professor of Mathematics 
> University of Washington 
> http://wstein.org 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to