简体   繁体   English

在表单提交的Drupal页面顶部添加Javascript

[英]Adding Javascript to head of drupal page on form submit

There is a page with a webform , and I need to add the facebook conversion code to the header of the page that is shown when the form is submitted. 有一个带有webform的页面,我需要将facebook转换代码添加到提交表单时显示的页面标题中。

The problem is that they are the same page. 问题在于它们是同一页。

When I want to edit the page there is a 'Confirmation message' box, however that will add code to the <body> of the page and not the <head> as facebook asks you to do. 当我要编辑页面时,有一个“确认消息”框,但是这会将代码添加到页面的<body>中,而不是Facebook要求您添加的<head>中。

I also don't think i can put in the head of the page because then it will show up also when the form is loaded and not only when it is submitted. 我也不认为我可以放在页面的开头,因为这样一来,表单加载时也会显示出来,而不仅仅是提交时。

I am also looking into the possibility of displaying it in the page only if the word "done" is in the url, but i'm not sure if that's possible, or if it's a bad idea. 我也正在研究仅在URL中包含单词“ done”的情况下才在页面中显示它的可能性,但是我不确定这是否可行,或者这不是一个好主意。

Any help is appreciated. 任何帮助表示赞赏。

Thanks 谢谢

我最终使用php来检查页面的URL,并且由于在提交表单后URL中有单词“ done”,因此我可以添加所需的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM