creating new pages through javascript

View: New views
3 Messages — Rating Filter:   Alert me  

creating new pages through javascript

by Bob Paige-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to create new pages through javascript and assign some default
content. If there is a better way to do this, I'm all ears.

What I am trying (and failing) is this:
[new
page|javascript:location.href="http:Edit.jsp?page="+escape(prompt('New%20page%20name...'))+"&_editedtext=[{TableOfContents}]"]

This will prompt the user for a name, then redirect to the edit.jsp for that
page. I have found that including the "&_editedtext=someting" on the URL
will populate the text area. But in this case (because I am trying to
include a call to a plugin) the ']' on the plugin is being interpreted as
the closeing ']' on the link. Is there some way to encode or otherwise
escape the ']' in this case?

Disclaimer:
I know I am opening myself up by allowing the javascript: interwiki link,
but this is an internal wiki so it should be ok.

Thanks.

--
Bobman

Re: creating new pages through javascript

by Florian Holeczek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hallo Bob,

what about %5D ? See http://www.i-technica.com/whitestuff/urlencodechart.html

Regards,
 Florian

Ursprüngliche Nachricht vom 07.07.2008 um 17:29:
> I am trying to create new pages through javascript and assign some default
> content. If there is a better way to do this, I'm all ears.

> What I am trying (and failing) is this:
> [new
> page|javascript:location.href="http:Edit.jsp?page="+escape(prompt('New%20page%20name...'))+"&_editedtext=[{TableOfContents}]"]

> This will prompt the user for a name, then redirect to the edit.jsp for that
> page. I have found that including the "&_editedtext=someting" on the URL
> will populate the text area. But in this case (because I am trying to
> include a call to a plugin) the ']' on the plugin is being interpreted as
> the closeing ']' on the link. Is there some way to encode or otherwise
> escape the ']' in this case?

> Disclaimer:
> I know I am opening myself up by allowing the javascript: interwiki link,
> but this is an internal wiki so it should be ok.

> Thanks.



smime.p7s (2K) Download Attachment

Re: creating new pages through javascript

by Bob Paige-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That works! Thanks Florian.

--
Bobman

On Mon, Jul 7, 2008 at 1:30 PM, Florian Holeczek <florian@...>
wrote:

> Hallo Bob,
>
> what about %5D ? See
> http://www.i-technica.com/whitestuff/urlencodechart.html
>
> Regards,
>  Florian
>
> Ursprüngliche Nachricht vom 07.07.2008 um 17:29:
> > I am trying to create new pages through javascript and assign some
> default
> > content. If there is a better way to do this, I'm all ears.
>
> > What I am trying (and failing) is this:
> > [new
> >
> page|javascript:location.href="http:Edit.jsp?page="+escape(prompt('New%20page%20name...'))+"&_editedtext=[{TableOfContents}]"]
>
> > This will prompt the user for a name, then redirect to the edit.jsp for
> that
> > page. I have found that including the "&_editedtext=someting" on the URL
> > will populate the text area. But in this case (because I am trying to
> > include a call to a plugin) the ']' on the plugin is being interpreted as
> > the closeing ']' on the link. Is there some way to encode or otherwise
> > escape the ']' in this case?
>
> > Disclaimer:
> > I know I am opening myself up by allowing the javascript: interwiki link,
> > but this is an internal wiki so it should be ok.
>
> > Thanks.
>
>
LightInTheBox - Buy quality products at wholesale price