Setting Page Title from a SWF

泄露秘密 提交于 2019-12-23 18:37:31

问题


Is it possible to set the title of a page when it's simply a loaded SWF?


回答1:


This is how I would do it:

ExternalInterface.call("document.title = 'Hello World'");

Or more generalized:

function setPageTitle( newTitle : String ) : void {
  var jsCode : String = "function( title ) { document.title = title; }";

  ExternalInterface.call(jsCode, newTitle);
}



回答2:


Sure. This should fix you up:

getURL('javascript:var x = (document.getElementsByTagName("head")[0].getElementsByTagName("title")[0].firstChild.nodeValue = "This is a test!");');

Just replace "This is a test!" with your new title.




回答3:


I would think you would be able to do it. You would have to access the javascript DOM.

A couple links that may steer you down the correct path..

http://homepage.ntlworld.com/kayseycarvey/document2.html

http://www.permadi.com/tutorial/flashjscommand/




回答4:


You could use SWFAddress, it has a setTitle method. Plus, you get the added benefit of beng able to modify the URL for deep-linking.

EDIT: This won't work if the SWF is loaded directly in the browser, only if it is embedded in HTML.




回答5:


I came up with the same problem of setting up the title of my page. Madw hell lot of efforts from downloading aspFlash controls to those swfObject....

Finally my team lead came up the solution....

open the pop of one page and in that page use one IFrame and use the Iframe to load the swf file.

So there are 2 page outer one is our control so just set the title.. inner one is the Iframe which is just another page so load the swf file directly by setting the scr="file path"



来源:https://stackoverflow.com/questions/87909/setting-page-title-from-a-swf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!