Tag Of A HTML Page?
Ad

How To Run A Script Inside The Tag Of A HTML Page?

- 1 answer

I have a weird situation where I need to run a script inside of the <title></title> tags. I have no access to any of the others parts of the page, including the <head></head> tags. It has to be within the <title></title> tags (the reason is because we are dealing with an iframe response from a 3rd party server and we don't really have access to the full page.).

What I tried was:

<title>
  <script type="javascript">
    runMyFunction();
  </script>
</title>

The problem is that it interprets the whole thing as a script. Is there anything I could do to tell the browser to run that code as a script and not treat it as a string?

Ad

Answer

<title>[trick</title>
  <script type="javascript">
    runMyFunction();
  </script>
<title>:)]</title>

Everyting between the [] is what you should set as title. Most probably it won't work though, 'cause if I were them I would properly encode whatever string you send, in order not to let you do any tricks...

Ad
source: stackoverflow.com
Ad