javascript对象oncreate事件,例如在win32 api编程中-是否可能 [英] javascript object oncreate event like in win32 api programming - is it possible

查看:90
本文介绍了javascript对象oncreate事件,例如在win32 api编程中-是否可能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想监视对象的创建. 例如,我想使用JavaScript动态地将一些https链接更改为http. 我可以通过获取所有对象锚来在页面onload事件中完成此操作,并且可以替换href. 但我想在对象创建的实例上执行此操作,而不是等到页面已加载.因此,为防止用户单击页面顶部已经出现的任何链接,并且如果该页面需要花费一些时间来加载,则该网址将替换为我所需的路径.因此,这就是我想将href更改为其他url或将https替换为http的原因.

I want to monitor object creation. for example i want to dynamically change some https links to http using javascript. i can do it in the page onload event by fetching all object anchors and can replace the href. but i want to do that at the instance of the object creation instead of waiting till the page has loaded. so to prevent users from clicking any link which had already appeared at the top of the page and if the page is taking some time to load then the url would have had replaced to my desired path. so that is the reason i want to change the href to a different url or replace https to http.

我还没有听说过create事件,所以我在这里发布了消息.人们应该拥有我们尚未听到,阅读或使用过的替代品或其他选择.

i haven't heard or read about on create event so i am posting it here. people should have alternatives or other options which we have not yet heard, read or used.

推荐答案

您确定JavaScript是正确的选择吗? 您没有访问服务器端的权限,只是更改那里的链接? 因为禁用了JS的用户仍会看到并使用https,所以我认为您不应该使用JS解决问题.

Are you sure JavaScript is the right way to go here? Don't you have access to the server side, to just change the links there? Because users with JS disabled would still see and use https, I don't think you should tackle the problem using JS.

这篇关于javascript对象oncreate事件,例如在win32 api编程中-是否可能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆