Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Javascript causes Edit mode to open a viewpage.action? URL

Adrian Johnston March 8, 2017

Hello everyone,

I have a small javascript placed inside a HTML macro on my confluence page.
The output of the javascript (a timer) looks fine.

However when a user clicks edit they are taken to an almost blank page (no confluence header or menu etc) containing just the output of the javascript.

The URL is along the lines of https://mycompany.com/viewpage.action?pageId=12345678

If I edit the viewpage.action back to editpage.action I see a normal edit view and can proceed.

Any advice as to how this can be avoided? (Couldn't find any threads on similar issues when I searched).
Cheers, Adrian

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Andreas Purde
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2017

Dear Adrian,

did you check the browser's console output whether it indicates any error? As far as I know scripts in a HTML macro are executed again when you hit the Edit button before the editor is shown. In case something goes wrong here the editor might never show.

Greetings, Andreas

Adrian Johnston March 12, 2017

Hi Andreas,

Thanks for your interest and suggestions.
As far as I can figure out the strange behaviour is caused by setting the javascript source to a js file uploaded as a confluence attachment. If I move the js file to an external URL the edit page opens normally. Either way it looks the same to a user until they click on EDIT.

Cheers, Adrian

TAGS
AUG Leaders

Atlassian Community Events